Thanks artemka for your reply. The thing I am trying to do is - I will be getting a string that is having different names (or whatever you may consider) separated by a delimiter. This is a work-around to passing an array into a stored procedure. Now I want to get individual elements out of it.
For loop is okay, I will have to use it - but do we have
1. any informix function that gives tokens out of the strings provided a delimiter?
2. or that gives the first index of a character (that will be , or |) and then I can use SUBSTR to get the substrings.
Thanks for your response once again. Best regards.
Okay, got something. Here is the function to do this - haven't tested if it works for me but yes I have the tools (functions) to make it possible now..
CREATE PROCEDURE Cut (string VARCHAR(255), delimiter CHAR(1))
DEFINE i INTEGER;
DEFINE loc INTEGER;
DEFINE res VARCHAR(255);
LET loc = FindStr(string, delimiter);
IF loc = 0 THEN
LET res = '';
FOR i = 1 TO loc - 1
LET res = res || string[1,1];
LET string = string[2,255];
But again, I have another question linked to it. If I increase the length of the argument from 255 to anything like 10000 or something. It gives an error saying maximum length has been exceeded.
What would I do to take care of strings quite longer in size? What is the datatype that I can use? Text? The input will be a big one for me.
Text data type seems to be the one right for such big input but the thing is that I am not sure if the function FindStr would work on it? Will it? I see that we can retrieve part of the Text using start and end bytes. But to find that I need to use FindStr.