[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
CASE
Statement
CASE case_value WHEN when_value THEN statement [WHEN when_value THEN statement ...] [ELSE statement] END CASE |
or
CASE WHEN search_condition THEN statement [WHEN search_condition THEN statement ...] [ELSE statement] END CASE |
CASE
implements a complex conditional construct. If a
search_condition
evaluates to true, the corresponding SQL statement is executed. If no search condition matches, the statement in the ELSE
clause is executed.
Please note that the syntax of a CASE
statement inside a stored
procedure differs slightly from that of the SQL CASE
expression. The
CASE
statement can not have an ELSE NULL
clause, and the
construct is terminated with END CASE
instead of END
.
See section 12.1.4 Control Flow Functions.