Re: Is there a DECODE function?
Posted in 1997
avia@telegate.co.il (Avi Abrami) wrote: :Greetings All! : :As someone with an ORACLE background, and now working with INFORMIX, Congratulations. :I wanted to ask if there is an INFORMIX equivalent for ORACLE's DECODE :function. : :e.g. SELECT DECODE(col1,'X',0,'Y',1,2) FROM tbl1 : :i.e. select column "col1" from database table "tbl1". If the value of :the column is the letter "X", return zero (0), if the value is "Y", :return 1, otherwise return 2. Unfortunately there is currently no such function. As far as I know the proper implementation of this kind of functionality according to the ANSI SQL standard is the use of a case statement. There are rumors that will be in 7.3 due out around the end of the year. In the meantime you can allways write a simple stored procedure that does this for you and use it in a similar way in your select statement. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org