17.10 - Usage Notes - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

Internal Representation of INTERVAL YEAR TO MONTH

Conceptually, INTERVAL YEAR TO MONTH is a record with two fields.

Field Name Storage Format Total Length

External Representation of INTERNAL YEAR TO MONTH

INTERVAL YEAR TO MONTH types are imported and exported in record and indicator modes as CHARACTER data using the client character set.

Type Format
CHARACTER(precision + 4) '-y(precision)-mm'

An example value for INTERVAL YEAR(3) TO MONTH is ' 013-11'.

Range of Values

The range of values for the INTERVAL YEAR TO MONTH is as follows.

Type and Precision Minimum Value Maximum Value
INTERVAL YEAR(1) TO MONTH -'9-11' '9-11'
INTERVAL YEAR(2) TO MONTH -'99-11' '99-11'
INTERVAL YEAR(3) TO MONTH -'999-11' '999-11'
INTERVAL YEAR(4) TO MONTH -'9999-11' '9999-11'
Decimal values are not allowed for Interval data types except for second intervals.

Implicit and Explicit INTERVAL YEAR TO MONTH Conversion

Vantage performs implicit conversion from one Interval data type to another Interval type in some cases. You can also use CAST to explicitly convert one Interval type to another.

Conversions are possible only within the same INTERVAL family. For example, you may convert a YEAR interval to months, but not to days or hours.

For more information, see Teradata Vantageā„¢ - SQL Functions, Expressions, and Predicates, B035-1145.