PL/SQL NULLIF

Oracle PL/SQL NULLIF Function

The NULLIF function compares two expressions. If exp1 and exp2 are not equal then return exp1. If exp1 and exp2 are equal the function returns NULL.

The NULLIF Function syntax:

NULLIF( exp1, exp2 )

Example:

select NULLIF(24, 24) from dual;

NULL


select NULLIF(24, 25) from dual;

24


select NULLIF('oracle', 'database') from dual;

oracle


select NULLIF('forms', 'forms') from dual;

NULL