Entering content frame

General CASE Function (searched_case_function) Locate the document in the library structure

The general CASE function (searched_case_function) is a special function that analyzes a quantity of search conditions to determine a result expression.

Syntax

<searched_case_function> ::=
CASE
  WHEN <
search_condition> THEN <result_expression>
    [...]
  [ELSE <default_expression>])
END

<result_expression> ::= <expression>
<default_expression> ::= <expression>

Examples

SQL Tutorial, Structure linkFunctions

Explanation

CASE checks the search conditions (search_condition) in succession. As soon as a search condition that is true is found, the result of the general CASE function is the value of the expression result_expression that belongs to the search condition.

If no true search expression is found, then CASE gets the result of the expression default_expression. If default_expression is not specified, the result of CASE is the NULL value.

All search conditions without ROWNO Predicate are permissible. The data types of the expressions result_expression and default_expression must be comparable.

See also:

Simple CASE function (simple_case_function)

 

Leaving content frame