NULLIFZERO Function Examples | Teradata Vantage - Examples - Advanced SQL Engine - Teradata Database

SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-30
dita:mapPath
tpt1555966086716.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1145
lifecycle
previous
Product Category
Teradata Vantage™

Example: Returned Expression Errors for NULLIFZERO

The following expressions return an error if the value of x or expression is zero.

   6 / x
   6 / expression

On the other hand, the following expressions return null, which is not an error because there is no violation of the divide by zero rule.

   6 / NULLIFZERO(x)
   6 / NULLIFZERO(expression)

Example: Returned Request Errors for NULLIFZERO

The following request returns a null in the second column because the HCap field value for Newman is zero. In BTEQ (field mode) this appears as a ‘?’.

   SELECT empno, NULLIFZERO(hcap) 
   FROM employee 
   WHERE empno = 10019 ;