IFNULL scalar function

The IFNULL function returns the first nonnull expression.

Read syntax diagramSkip visual syntax diagramIFNULL( expression, expression)

The schema is SYSIBM.

IFNULL is identical to the COALESCE scalar function except that IFNULL is limited to two arguments instead of multiple arguments. For a description, see COALESCE scalar function.

Example: For all the rows in sample table DSN8C10.EMP, select the employee number and salary. If the salary is missing (is null), have the value 0 returned.
   SELECT EMPNO, IFNULL(SALARY,0)
     FROM DSN8C10.EMP;