This Oracle tutorial explains how to use the Oracle/PLSQL NULLIF function with syntax and examples.
The Oracle/PLSQL NULLIF function compares expr1 and expr2. If expr1 and expr2 are equal, the NULLIF function returns NULL. Otherwise, it returns expr1.
The syntax for the NULLIF function in Oracle/PLSQL is:
First value to compare. Must be either a numeric value or a value that is the same datatype as expr2.
Second value to compare. Must be either a numeric value or a value that is the same datatype as expr1.
The NULLIF function returns NULL if expr1 and expr2 are equal. The NULLIF function returns expr1 if expr1 and expr2 are not equal.
The NULLIF function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle NULLIF function examples and explore how to use the NULLIF function in Oracle/PLSQL.
For example: