1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| 1) NULLIF (V1, V2) IS equivalent TO the following <CASE specification>:
CASE WHEN V1=V2 THEN NULL ELSE V1 END
2) COALESCE (V1, V2) IS equivalent TO the following <CASE specification>:
CASE WHEN V1 IS NOT NULL THEN V1 ELSE V2 END
3) COALESCE (V1, V2, . . . ,n ), FOR n >= 3, IS equivalent TO the
following <CASE specification>:
CASE WHEN V1 IS NOT NULL THEN V1 ELSE COALESCE (V2, . . . ,n )
END
4) IF a <CASE specification> specifies a <simple case>, THEN let CO
be the <CASE operand>:
a) The DATA TYPE OF each <WHEN operand> WO shall be comparable
WITH the DATA TYPE OF the <CASE operand>.
b) The <CASE specification> IS equivalent TO a <searched case>
IN which each <searched WHEN clause> specifies a <SEARCH
condition> OF the form"CO=WO".
5) At least one <result> IN a <CASE specification> shall specify a
<RESULT expression>.
6) IF an <ELSE clause> IS NOT specified, THEN ELSE NULL IS im-
plicit.
7) The DATA TYPE OF a <CASE specification> IS determined BY ap-
plying Subclause 9.3,"Set operation result data types", TO the
DATA types OF ALL <RESULT expression>s IN the <CASE specifica-
tion>.
Access Rules
NONE.
General Rules
1) CASE:
a) IF a <result> specifies NULL, THEN its VALUE IS the NULL
VALUE.
b) IF a <result> specifies a <VALUE expression>, THEN its VALUE
IS the VALUE OF that <VALUE expression>.
2) CASE:
a) IF the <SEARCH condition> OF SOME <searched WHEN clause> IN
a <CASE specification> IS TRUE, THEN the VALUE OF the <CASE
specification> IS the VALUE OF the <result> OF the FIRST
(leftmost) <searched WHEN clause> whose <SEARCH condition> IS
TRUE, CAST AS the DATA TYPE OF the <CASE specification>.
b) IF no <SEARCH condition> IN a <CASE specification> IS TRUE,
THEN the VALUE OF the <CASE expression> IS the VALUE OF the
<result> OF the explicit OR implicit <ELSE clause>, CAST AS
the DATA TYPE OF the <CASE specification>. |