17.10 - Usage Notes - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

Internal Representation of INTERVAL SECOND

Conceptually, the internal representation of INTERVAL SECOND consists of the following fields.

Field Name Storage Format Total Length
WHOLE SECONDS SMALLINT 6 bytes
FRACTIONAL SECONDS INTEGER

External Representation of INTERVAL SECOND

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

WHEN fractional_seconds_precision is … THEN the type and format are ...
0 Type: CHARACTER(precision + 1)
Format: '-s(precision)'
n

where n is 1 - 6

Type: CHARACTER(precision + n + 2)
Format: '-s(precision).s(n)'

For example, for INTERVAL SECOND(3,2), the value might be something like '-127.35'.

Range of Values

The range of values for INTERVAL SECOND is as follows.

Type, Precision, and Fractional Seconds Precision Minimum Value Maximum Value
INTERVAL SECOND(1,0) -'9' '9'
INTERVAL SECOND(1,1) -'9.9' '9.9'
INTERVAL SECOND(1,2) -'9.99' '9.99'
INTERVAL SECOND(1,3) -'9.999' '9.999'
INTERVAL SECOND(1,4) -'9.9999' '9.9999'
INTERVAL SECOND(1,5) -'9.99999' '9.99999'
INTERVAL SECOND(1,6) -'9.999999' '9.999999'
INTERVAL SECOND(2,0) -'99' '99'
INTERVAL SECOND(2,1) -'99.9' '99.9'
INTERVAL SECOND(2,2) -'99.99' '99.99'
INTERVAL SECOND(2,3) -'99.999' '99.999'
INTERVAL SECOND(2,4) -'99.9999' '99.9999'
INTERVAL SECOND(2,5) -'99.99999' '99.99999'
INTERVAL SECOND(2,6) -'99.999999' '99.999999'
INTERVAL SECOND(3,0) -'999' '999'
INTERVAL SECOND(3,1) -'999.9' '999.9'
INTERVAL SECOND(3,2) -'999.99' '999.99'
INTERVAL SECOND(3,3) -'999.999' '999.999'
INTERVAL SECOND(3,4) -'999.9999' '999.9999'
INTERVAL SECOND(3,5) -'999.99999' '999.99999'
INTERVAL SECOND(3,6) -'999.999999' '999.999999'
INTERVAL SECOND(4,0) -'9999' '9999'
INTERVAL SECOND(4,1) -'9999.9' '9999.9'
INTERVAL SECOND(4,2) -'9999.99' '9999.99'
INTERVAL SECOND(4,3) -'9999.999' '9999.999'
INTERVAL SECOND(4,4) -'9999.9999' '9999.9999'
INTERVAL SECOND(4,5) -'9999.99999' '9999.99999'
INTERVAL SECOND(4,6) -'9999.999999' '9999.999999'

Implicit and Explicit INTERVAL SECOND 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.