[thelist] [SQL] Case vs Decode

rudy r937 at interlog.com
Mon Mar 3 19:11:07 CST 2003


> Just as a matter of interest - anyone know of any articles / have any
comments on
> when and where it is better to use a CASE statement, as opposed to DECODE?

oh, man, ain't it great when i can find good examples via google faster than
i could write something similar myself --

"DECODE is a bastardized and non-standard version of CASE statement"
http://www.experts-exchange.com/Databases/Microsoft_SQL_Server/Q_10373042.ht
ml

"The CASE expression supports the use of SELECT statements for performing
Boolean tests, which the DECODE statement does not allow."
http://www.schemamania.org/jkl/booksonline/SQLBOL70/html/2_005_37.htm


it would not surprise me to learn that DECODE goes quite far back in terms
of when it was first available in the oracle sql language, whereas CASE is
probably a more recent addition

in any case, i'd use CASE, in, um, all cases ...

rudy




More information about the thelist mailing list