Date and time literals declare date, time, or timestamp values in an SQL expression.
ANSI DateTime Literals
- DATE
- TIME
- TIMESTAMP
Teradata SQL Date and Time Literals
Teradata also provides a non-ANSI extension to DateTime functionality.
Teradata SQL literals used with date or time values are simple string literals and are interpreted as character data. The character data is converted to a date or time value based on the context, typically provided by a FORMAT clause.
The existing Teradata SQL operations on character string literals used to represent date and time values are supported as a non-ANSI extension to DateTime functionality.
While Teradata SQL date and time literals come in a variety of formats for the character representations of date and time values, and so cannot be restricted to a default or standard format, ANSI DateTime literals are restricted to a strict set of formats.
Existing functionality for Teradata SQL date literals is preserved.
For example, suppose a column is defined as DATE with a format of 'YY/MM/DD'. If the value '97/12/31' is encountered as a character literal assigned to a DATE column, the process works as before the introduction of ANSI DateTime formats because the character literal is implicitly cast to the DATE format.
Unless explicitly stated, this section only discusses ANSI DateTime literals.