Friday, June 09, 2006

NULLIF - DB2 function

The NULLIF function returns null if the two arguments are equal; otherwise, it returns the value of the first argument.
The two arguments must be compatible and comparable. Neither argument can be a BLOB, CLOB, DBCLOB, or distinct type. Character-string arguments are compatible and comparable with datetime values.

Ex:
Assume that host variables PROFIT, CASH, and LOSSES have decimal data types with the values of 4500.00, 500.00, and 5000.00 respectively. The following function returns a null value:

NULLIF (:PROFIT + :CASH , :LOSSES)

No comments: