NVL is a function used in SQL that allows you to replace null values with a more meaningful alternative in the results of a query. It is a substitution function, which means it displays one value while another is NULL. NVL is not an acronym for anything, unlike a lot of programming/database terminology. Its just NVL, but thinking of it as a Null Value might help. The syntax of the NVL function is NVL(expr1, expr2)
, where expr1
is the source value or expression that may contain a null, and expr2
is the target value for converting the null. If expr1
is null, then NVL returns expr2
. If expr1
is not null, then NVL returns expr1
.
It is important to note that NVL is not available in MySQL or SQL Server, but ISNULL and IFNULL can be used instead. There are also other functions that work like NVL, such as NVL2, DECODE, COALESCE, NULLIF, LNNVL, and NANVL.