Skip to main content
Version: V1.0.0

NVL

Declaration

NVL(str1,replace_with)

Description

If str1 is NULL, then NVL(str1, replace_with) returns the value specified by replace_with. str1 is typically a column name. replace_with can be a hard-coded value, a reference to another column, or an expression.

This capability to automatically replace NULL values can provide more complete output.

Examples

SELECT NVL(NULL, 0), NVL(NULL, 'a');
+--------------+----------------+
| NVL(NULL, 0) | NVL(NULL, 'a') |
+--------------+----------------+
| 0 | a |
+--------------+----------------+
1 row in set (0.001 sec)