- Categories:
NVL¶
If expr1
is NULL, returns expr2
, otherwise returns expr1
.
- Aliases
Syntax¶
NVL( <expr1> , <expr2> )
Arguments¶
expr1
The expression to be checked to see whether it is NULL.
expr2
If
expr1
is NULL, this expression is evaluated and its value is returned.
Collation Details¶
The collation specifications of all input arguments must be compatible.
The collation of the result of the function is the highest-precedence collation of the inputs.
Examples¶
Call NVL with both NULL and non-NULL values for the first expression:
SELECT NVL('food', 'bard') AS col1, NVL(NULL, 3.14) AS col2; +------+------+ | COL1 | COL2 | +------+------+ | food | 3.14 | +------+------+