Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
A poster asked for an Informix function to return the Nth delimited field of a string such as 12|A|B and to find a character's position. Tichman suggested unloading and using cut. Marco Greco asked which product (4GL, IDS, etc.) was meant, since answers differ. The poster replied he used dbaccess on IDS, probably 9.40 FC7. No solution was given.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
I have a string for eg: "12|A|B", and need a function that takes "|" as
field delimeter and returns 2nd or say 3rd column. Is it possible to do
this in informix. For Eg: If I ask for 2nd column I get "A".
Also, is there a way to find a position of character in a string. For
Eg: "ABCD" - C's position is 3.
One way would be to unload the table then use cut to get the fields you
need.
cat unloadfile | cut -d"|" -f 2,3
mohitanch...@gmail.com wrote:
> I have a string for eg: "12|A|B", and need a function that takes "|" as
> field delimeter and returns 2nd or say 3rd column. Is it possible to do
> this in informix. For Eg: If I ask for 2nd column I get "A".
>
> Also, is there a way to find a position of character in a string. For
> Eg: "ABCD" - C's position is 3.
↪ replying to mohitanchlia@gmail.com
Marco Greco — — source: Usenet: comp.databases.informix
mohitanchlia@gmail.com wrote:
> I have a string for eg: "12|A|B", and need a function that takes "|" as
> field delimeter and returns 2nd or say 3rd column. Is it possible to do
> this in informix. For Eg: If I ask for 2nd column I get "A".
>
> Also, is there a way to find a position of character in a string. For
> Eg: "ABCD" - C's position is 3.
Your question needs some qualification: eg do you want to do that within
- Informix 4gl?
- Informix Dynamic Server?
(I'll spare you the list of Informix products - but others may apply)
You'll find you'll get different answers depending on what product you are
referring to, and even what feature of the product
--
Ciao,
Marco
______________________________________________________________________________
Marco Greco /UK /IBM Standard disclaimers apply!
Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
4glworks http://www.4glworks.com
Informix on Linux http://www.4glworks.com/ifmxlinux.htm
Marco Greco wrote:
> mohitanchlia@gmail.com wrote:
> > I have a string for eg: "12|A|B", and need a function that takes "|" as
> > field delimeter and returns 2nd or say 3rd column. Is it possible to do
> > this in informix. For Eg: If I ask for 2nd column I get "A".
> >
> > Also, is there a way to find a position of character in a string. For
> > Eg: "ABCD" - C's position is 3.
>
> Your question needs some qualification: eg do you want to do that within
> - Informix 4gl?
> - Informix Dynamic Server?
> (I'll spare you the list of Informix products - but others may apply)
>
> You'll find you'll get different answers depending on what product you are
> referring to, and even what feature of the product
> --
> Ciao,
> Marco
> ______________________________________________________________________________
> Marco Greco /UK /IBM Standard disclaimers apply!
>
> Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
> 4glworks http://www.4glworks.com
> Informix on Linux http://www.4glworks.com/ifmxlinux.htm
I am not really a pro in informix, what I can tell is that I invoke
dbaccess and type SQL in there to execute it. I think it's informix
dynamic server (IDS) because I could use MULTISET which is part of IDS.
Please let me know how do I find out if you need to know. I think
Informix version is 9 40 FC7 (if this makes sense).
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.