NVL2

Purpose

This function replaces NULL values with expr3, otherwise it uses expr2.

Syntax

nvl2::=

Usage Notes

  • If expr1 is NULL, then expr3 is returned, otherwise expr2 is returned.
  • The abbreviation NVL stands for "Null Value".
  • If there is no legal type conversion between expr2 and expr3, then the function returns an error.
  • For additional information, see NVL.

Example

SELECT NVL2(NULL, 2, 3) NVL_1,
       NVL2(1, 2, 3) NVL_2;
Result
NVL_1 NVL_2
3 2