NULLIFZERO Function Examples | Teradata Vantage - Examples - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
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 ;