NULLIFZERO Function
The NULLIFZERO function returns the value of the expression if that value is not zero. It returns
NULL if the value of the expression is zero.
NULLIFZERO (expression)
expression
specifies a value expression. It must be a numeric data type.
Examples of NULLIFZERO
•
This function returns the value of the column named salary for each row where the
column's value is not zero. It returns a NULL for each row where the column's value is zero
.
SELECT NULLIFZERO (salary) from employee_tab;
•
This function returns a value of 1:
SELECT NULLIFZERO(1) from (values(1)) x(a);
•
This function returns a value of NULL:
SELECT NULLIFZERO(0) from (values(1)) x(a);
378
SQL Functions and Expressions