A CASE expression is a conditional expression, i.e. an expression that contains conditions. Each condition is assigned an expression or the NULL value.
When the CASE expression is evaluated, the assigned expression value or NULL value is returned to whichever condition is true.
There are different types of CASE expression:
CASE expression with search condition
Simple CASE expression
CASE expression with NULLIF
CASE expression with COALESCE
CASE expression with MIN or MAX
The syntax of the various types of expression is shown in the following overview:
case_expression ::=
{
| |
|
The types of CASE expression are described below.