Description

label
Specifies the label for the CASE statement. The label name cannot be the same as the routine name or another label within the same scope. For more information, see Handling errors and warnings.
simple-when-clause
The value of the expression prior to the first WHEN keyword is tested for equality with the value of each expression that follows the WHEN keyword. If the comparison is true, the THEN statement is executed. If the result is unknown or false, processing continues to the next comparison. If the result does not match any of the comparisons, and an ELSE clause is present, the statements in the ELSE clause are processed.
searched-when-clause
The search-condition following the WHEN keyword is evaluated. If it evaluates to true, the statements in the associated THEN clause are processed. If it evaluates to false, or unknown, the next search-condition is evaluated. If no search-condition evaluates to true and an ELSE clause is present, the statements in the ELSE clause are processed.
else-clause
If none of the conditions specified in the simple-when-clause or searched-when-clause are true, then the statements in the else-clause are executed.

If none of the conditions specified in the WHEN are true, and an ELSE clause is not specified, an error is issued at runtime, and the execution of the CASE statement is terminated (SQLSTATE 20000).

SQL-procedure-statement
Specifies a statement that should be executed. See SQL-procedure-statement.