Scalar Operations on Teradata DATE Values | Teradata Vantage - Scalar Operations on Teradata DATE Values - Advanced SQL Engine - Teradata Database

SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
xmd1556127764262.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1211
lifecycle
previous
Product Category
Teradata Vantageā„¢

The operations of addition and subtraction are allowed as follows, where integer values represent the number of days:

Argument 1 Operation Argument 2 Result
DATE + INTEGER DATE
DATE - INTEGER DATE
INTEGER + DATE DATE
DATE - DATE INTEGER

Adding 90 days, for example, is not identical to adding 3 months, because of the varying number of days in months.

Also, adding multiples of 365 days is not identical to adding years because of leap years.

Note that scalar operations on Teradata DATE expressions are performed using ANSI SQL:2011 data types, so an expression of the type date_expression - numeric_expression is treated as if the numeric_expression component were typed as INTERVAL DAY.

ANSI SQL:2011 DateTime and Interval values have their own set of scalar operations and with the exception of the scalar operations defined here for DATE, do not support the implicit conversions to resolve expressions of mixed data types.