NULLIF

ANSI DB2 SQL/DS XDB
X X   X

Use the NULLIF function wherever an expression is used to return null if the two arguments are equal; otherwise, the value of the first argument is returned. The two arguments must be compatible. The attributes of the result are the attributes of the first argument.

For example, if the result of the first argument is a character string, the result of the other must also be a character string; if the result of the first argument is a number, the result of the other must also be a number.

The format of the NULLIF function appears below:

NULLIF (expression,expression)

where:

expression Specifies a single value.