Link: http://oradbdev.mathiasmagnusson.com/2010/01/the-case-for-case.html
By Mathias Magnusson, November 2009
The CASE keyword was introduced in 8i (9i for PL*SQL) and essentially replaces DECODE. I confess to never liking decode, though it is powerful, it is also ugly and sometimes close to unreadable. Case introduces a few things decode cannot do, but it makes it more accessible to those who write SQL occasionally.
In this document we will look closer at the keyword CASE in SQL. While it often is treated just as a
readable replacement for decode, it has a few more uses. Readability is a feature in itself, but the most misunderstood part of case among developers is how flexible it is.
This article will only look at the basic use and not try to dig into every aspect of it. Thus it is geared more towards the intermediate SQL user than to the experts.



| ©2010 by Barry Chase |
Credits: