Is there a DECODE function? 
Author Message
 Is there a DECODE function?

: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.


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.***.com/



Wed, 18 Jun 1902 08:00:00 GMT
 Is there a DECODE function?


Quote:
> As someone with an ORACLE background, and now working with INFORMIX,
> I wanted to ask if there is an INFORMIX equivalent for ORACLE's
> DECODE function.

No, you'd have to write a stored procedure.

--
Ciao,
Billy

Nose to the ear in Johannesburg -- {*filter*} City never looked so good!
For a good time, call: http://www.***.com/

I installed a photo of Princess Di as "wallpaper" on my PC, just as
kind of a tribute or memorial or something.  Looks nice, but every
time I try and take a screen shot, my machine crashes.



Wed, 18 Jun 1902 08:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. wanted: decode( ) function

2. Functions like iif or decode

3. SQL Server equivalent of Oracle's decode function

4. ODBC function similiar to Oracle Decode

5. Functions like iif or decode

6. Decode Function

7. SQL Server equivalent of Oracle's decode function

8. Decode function

9. Functions like iif or decode

10. Migrating the Oracle DECODE function without using CASE?

11. Oracle Decode Function


 
Powered by phpBB® Forum Software