I. Features Introduced in Ingres II 2.5 : New SQL Functionality : CASE Expression
 
Share this page                  
CASE Expression
An ANSI SQL '92 compliant CASE expression has been added. The CASE expression allows if-then-else testing anywhere that an expression is allowed.
There are two syntax forms. The most general CASE expression is:
CASE WHEN boolean-expression THEN expression
WHEN boolean-expression THEN expression
...
ELSE otherwise-expression
END
Each boolean-expression is evaluated in turn, and if TRUE, the corresponding then expression is the CASE result. If all the boolean-expressions are of the form expr1 = expr2, a shorthand form can be used:
CASE expr1 WHEN expr2 THEN expression
WHEN expr3 THEN expression
...
ELSE otherwise-expression
END