Restrictions on the DEFAULT Function in a Predicate - 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ā„¢
The DEFAULT function returns the default value of a column. It has two forms: one that specifies a column name and one that omits the column name. Predicates support both forms of the DEFAULT function, but the following conditions must be true when the DEFAULT function omits the column name:
  • The predicate uses a comparison operator
  • The comparison involves a single column reference
  • The DEFAULT function is not part of an expression

For example, the following statement uses DEFAULT to compare the values of the Dept_No column with the default value of the Dept_No column. Because the comparison operation involves a single column reference, Vantage can derive the column context of the DEFAULT function even though the column name is omitted.

SELECT * FROM Employee WHERE Dept_No < DEFAULT;

Note that if the DEFAULT function evaluates to null, the predicate is unknown and the WHERE condition is false.