16.10 - INTERVAL DAY Data Type - Teradata Database

Teradata Database SQL Data Types and Literals

Teradata Database
June 2017
Programming Reference


Identifies a field as an INTERVAL value defining a period of time in days.


The permitted range of digits for DAY, ranging from one to four.
The default is two.
Appropriate data type, column storage, or column constraint attributes.
See Core Data Type Attributes and Storage and Constraint Attributes for specific information.

ANSI Compliance

INTERVAL DAY is ANSI SQL:2011 compliant.

Internal Representation of INTERVAL DAY

Storage Format Length
SMALLINT 2 bytes

External Representation of INTERVAL DAY

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

Type Format
CHARACTER(precision + 1) '-d(precision)'

For example, for INTERVAL DAY(2), the value might be something like '-39'.

Range of Values

The range of values for INTERVAL DAY is as follows.

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

Implicit and Explicit INTERVAL DAY Conversion

Teradata Database 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 “Data Type Conversions” in SQL Functions, Operators, Expressions, and Predicates.

Example: INTERVAL DAY Data Type

The following statement creates a table with an INTERVAL DAY column:

     (Id INTEGER
     ,Offset INTERVAL DAY (4));