The Oracle and PL/SQL NULLIF function compares expr1 and expr2. If they are equal, then the function returns null. If they are not equal, then the function returns expr1.
The general format is:
NULLIF(expr1, expr2)
You cannot specify the literal NULL for expr1 but can be an expression that evaluates to NULL.
Example 1:
SELECT NULLIF('pear','apple') FROM DUAL;
returns:
pear
Example 2:
SELECT NULLIF('apple','apple') FROM DUAL;
returns:
NULL