The NULLIF function returns a null value if the arguments compare equal, otherwise it returns the value of the first argument.
compatible
data
types.
An expression that returns a value of any built-in
data type other than a DATALINK or XML or any distinct data type other
than a distinct type that is based on a DATALINK or XML.
An expression that returns a value of any built-in
data type other than a DATALINK or XML or any distinct data type other
than a distinct type that is based on a DATALINK or XML .
The attributes of the result are the attributes of the first argument. The result can be null. The result is null if the first argument is null or if both arguments are equal.
CASE WHEN e1=e2 THEN NULL ELSE e1 END
Note that when e1=e2 evaluates to unknown (because one or both arguments is NULL), CASE expressions consider this not true. Therefore, in this situation, NULLIF returns the value of the first operand, e1.
SELECT NULLIF (:PROFIT + :CASH, :LOSSES ) FROM SYSIBM.SYSDUMMY1Returns the null value.