NVL

2024-04-19 08:42:50  Updated

Syntax

NVL(str1,replace_with)

Purpose

NVL() replaces NULL with the specified value. If the value of str1 is NULL, the value specified by replace_with is returned. str1 is generally a column name. replace_with can be a literal (for example, a hard-coded value), a reference to another column, or an expression.

This replacement improves the output.

Examples

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

Contact Us