Usage Notes - Analytics Database - Teradata Vantage

SQL Date and Time Functions and Expressions

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
2023-10-30
dita:mapPath
cpk1628111786971.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
pxz1544241488545
lifecycle
latest
Product Category
Teradata Vantage™
The following rules apply to arithmetic operators and Period data types:
  • The interval expression must be a valid interval expression and must follow the rules of an Interval expression (see “ANSI Interval Expressions”). Otherwise, an error is reported. For example, the interval expression (DATE '2006-02-03' - DATE '2005-02-03') DAY, results in a value of 365 days which cannot fit into the default precision 2 of the interval qualifier DAY; therefore, an error is reported.
  • The period arithmetic operations of adding or subtracting an Interval to or from a period or adding a period to an Interval follow the rules of DateTime expressions. Otherwise, errors are reported. See ANSI Interval Expressions for details on DateTime expression rules.
  • An interval expression can be subtracted from a Period expression but not vice versa. If a Period expression is subtracted from an interval expression, an error is reported.
  • For a Period expression with an element type of TIME, if the Period arithmetic operation results in a beginning bound less than the ending bound, an error is reported.
  • For a period of element type DATE or TIMESTAMP, if the ending bound is UNTIL_CHANGED, the ending bound in the result ending bound is UNTIL_CHANGED. If the ending bound is not UNTIL_CHANGED and the ending bound in the result evaluates to an UNTIL_CHANGED value, an error is reported.
  • For a period arithmetic operation, one of the operands must be an INTERVAL data type. Otherwise, an error is reported.