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
Variables : l_field
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 ?
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.