Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Posts
    1

    Unanswered: SPL string manipulation question

    Hi,

    I'm parsing a file that contains a string and an other field that contains the length of the first field. What I want to do is to be able ton substring the first field so I can only keep the number of characters in the second field.

    For example :

    Parameters : p_field1
    p_length

    Variables : l_field

    Code :
    LET l_field = p_field1[1,p_length]

    But when I put l_length as a parameter, it does not work. I need to put an integer. Is there a way to do this to use the p_length parameter instead on an integer fix value ?

    Thanks,

    Chantale

  2. #2
    Join Date
    Aug 2006
    Location
    The Netherlands
    Posts
    248
    Hi,

    you're trying to do this in a stored procedure I presume. In a SP you can't use the string-indexed method of string division like in SQL or 4GL. You have to use the SQL function SUBSTR(string, first-character-position, length-of-substring). And you can use variables as arguments ofcourse.

    Regards,
    Hans

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •