15.10 - INTERVAL HOUR Data Type - Teradata Database

Teradata Database SQL Data Types and Literals

prodname
Teradata Database
vrm_release
15.10
category
Programming Reference
featnum
B035-1143-151K

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

where:

 

Syntax element …

Specifies …

precision

the permitted range of digits for HOUR, ranging from one to four.

The default is two.

attributes

appropriate data type, column storage, or column constraint attributes.

See “Core Data Type Attributes” on page 17 and “Storage and Constraint Attributes” on page 18 for specific information.

INTERVAL HOUR is ANSI SQL:2011 compliant.

 

Storage Format

Length

SMALLINT

2 bytes

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

 

Type

Format

CHARACTER(precision + 1)

'-h(precision)'

For example, for INTERVAL HOUR(1), the value might be something like '-5'.

The range of values for INTERVAL HOUR is as follows.

 

Type and Precision

Minimum Value

Maximum Value

INTERVAL HOUR(1)

-'9'

'9'

INTERVAL HOUR(2)

-'99'

'99'

INTERVAL HOUR(3)

-'999'

'999'

INTERVAL HOUR(4)

-'9999'

'9999'

Note: Decimal values are not allowed for Interval data types except for second intervals.

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.