Entering content frame

Simple CASE Function (simple_case_function) 

The simple CASE function (simple_case_function) is a special function that analyzes a quantity of simple expressions to determine a result expression.

Syntax

<simple_case_function> ::=
CASE <check_expression>
        WHEN <search_expression> THEN <result_expression>
            [...]
        [ELSE <default_expression>])
END

<check_expression> | <search_expression> | <result_expression> | <default_expression> ::= <expression>

expression

Explanation

CASE compares the value of the comparison expression check_expression with the values of the expressions search_expression, one after the other. If values match, the result of the simple CASE function is the value of the expression result_expression that belongs to the expression search_expression.

If no values match, DECODE gets the result of the expression default_expression. If default_expression is not specified, then the result of CASE is NULL.

The data types of check_expressionand search_expressionmust be comparable. The data types of result_expression and default_expression must be comparable. The data types of search_expressionand result_expressiondo not need to be comparable.

If the values of the expressions check_expression and search_expression are NULL values, then a match exists. The comparison of the special NULL value with any other value never results in a match.

See also:

General CASE Function (searched_case_function)

 

Leaving content frame