Provides an abbreviated CASE expression by comparing expressions.
Parameter |
Description |
---|---|
expression1 |
An expression to be compared. |
expression2 |
An expression to be compared. |
Data type of the first argument.
The following statement returns a:
SELECT NULLIF( 'a', 'b' ) FROM iq_dummy
The following statement returns NULL:
SELECT NULLIF( 'a', 'a' ) FROM iq_dummy
NULLIF compares the values of the two expressions.
If the first expression equals the second expression, NULLIF returns NULL.
If the first expression does not equal the second expression, or if the second expression is NULL, NULLIF returns the first expression.
CASE WHEN expression1 = expression2 THEN NULL ELSE expression1 END