This is a discussion on ELF function ? within the DB2 forums, part of the Database Server Software category; --> Hi, my application uses the ELF function of MySql. How can I use that in DB2? Zsolt...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| "Zsolt Koppany" <zkoppanylist@intland.com> wrote in message news:bm5fie$hs4$01$1@news.t-online.com... > Hi, > > my application uses the ELF function of MySql. How can I use that in DB2? > > Zsolt > For those who don't know what ELF is, maybe you can explain it and then someone can figure out how to do that in DB2. |
| |||
| Sorry, I mistyped it, it is ELT. Zsolt "Larry Edelstein" <nospam@nospam.com> schrieb im Newsbeitrag news:3F86A532.526DC9C0@nospam.com... > What's "ELF"? > > > Zsolt Koppany wrote: > > > Hi, > > > > my application uses the ELF function of MySql. How can I use that in DB2? > > > > Zsolt > |
| ||||
| Zsolt Koppany <zkoppanylist@intland.com> wrote: > Sorry, > > I mistyped it, it is ELT. From what I gather in the MySQL documentation, a simple CASE expression will do the job. Here is what I found: ELT(N,str1,str2,str3,...) Returns str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is less than 1 or greater than the number of arguments. ELT() is the complement of FIELD(): mysql> SELECT ELT(1, 'ej', 'Heja', 'hej', 'foo'); -> 'ej' mysql> SELECT ELT(4, 'ej', 'Heja', 'hej', 'foo'); -> 'foo' I would implement this in DB2 (and standard SQL) like this: CASE n WHEN 1 THEN str1 WHEN 2 THEN str2 WHEN 3 THEN str3 ELSE NULL END -- Knut Stolze Information Integration IBM Germany / University of Jena |