NVL
NVL(expr1, expr2)

Returns an alternative value to use if a given input value is NULL. NVL returns expr2 if expr1 is NULL; otherwise, it simply returns expr1.

Parameters

expr1

Specifies a value to be tested for NULL. If this value is not NULL, it is also the value returned by the function.

expr2

Specifies a value to be returned when expr1 is NULL.

Example

SQL> SELECT username, NVL(TO_CHAR(lock_date),'Not Locked')
  2  FROM dba_users;

USERNAME                       NVL(TO_CHAR(LOCK_
------------------------------ -----------------
SYS                            Not Locked
SYSTEM                         Not Locked
...
GNIS                           21-May-2000 17:18

Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.