ZEROIFNULL

Purpose

This function returns 0 if number has value NULL. Otherwise, number is returned.

Syntax

zeroifnull::=

Usage Notes

  • The ZEROIFNULL function is equivalent to the CASE expression - CASE WHEN number is NULL THEN 0 ELSE number END.
  • Additionally, refer to NULLIFZERO.

Example

SELECT ZEROIFNULL(NULL) ZIN1, ZEROIFNULL(1) ZIN2;
Result
ZIN1 ZIN2
0 1