PL/SQL NVL2

Oracle PL/SQL NVL2 Function

The NVL2 function allow us to substitutes a value when a null value is founded as well as when a non null value is founded.

The NVL2 Function syntax:

NVL2( string, value_not_null, value_null )

Example 1:

Select e.empno, e.comm, NVL2(e.comm, 'YES', 'NO') Result From emp e;
Empno Comm Result
7369 NO
7499 300.00 YES
7521 500.00 YES
7566 NO

Example 2:

Select NVL2('', 'YES', 'NO') From dual;

NO