Thursday, 21 February 2013

DECODE to CASE

Recently had to transform an Oracle SQL Query into a Standard SQL Query. One of the three steps to take was changing the DECODE into a CASE.

DECODE is an Oracle specific function[1].

The case statements, though more standard, are a bit more wordy than the decode statements. As shown in the following, slightly more complex example.


References

[1] Oracle DECODE
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions040.htm
[2] Case and decode two powerfull constructs of sql t181
http://www.club-oracle.com/forums/case-and-decode-two-powerfull-constructs-of-sql-t181/

1 comment: