If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > SPL string manipulation question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-10, 10:04
Chantale Chantale is offline
Registered User
 
Join Date: Mar 2010
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 03-13-10, 05:36
Tyveleyn Tyveleyn is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On