NVL2
functionsupportedCore SQL functionsReturns values depending on whether the first input is NULL: - If expr1 is NOT NULL, then NVL2 returns expr2. - If expr1 is NULL, then NVL2 returns expr3.
Syntax
NVL2( <expr1> , <expr2> , <expr3> )
Parameters
| Name | Required | Description |
|---|---|---|
expr1 | required | The expression to be checked to see whether it is NULL. |
expr2 | required | If expr1 is not NULL, this expression will be evaluated and its value will be returned. |
expr3 | required | If expr1 is NULL, this expression will be evaluated and its value will be returned. |
Usage notes
- All three expressions should have the same (or compatible) data type.
Collation details
- The collation specification for expr1 is ignored because all that matters about this expression is whether it is NULL or not. - The collation specifications for expr2 and expr3 must be compatible. - The value returned from the function is the highest-precedence collation of expr2 and expr3.