NVL2 scalar function

The NVL2 function returns the second argument when the first argument is not NULL. If the first argument is NULL, the third argument is returned.

Read syntax diagramSkip visual syntax diagramNVL2(expression, result-expression,else-expression)

The schema is SYSIBM.

The NVL2 function is a synonym for the following statement:
CASE WHEN expression IS NOT NULL
     THEN result-expression
     ELSE else-expression
END