17.10 - Examples - 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)

Example: Converting string_value specified as an SQL Interval Format

The following query, which specifies an SQL interval format:

SELECT TO_DSINTERVAL('100 04:23:59'); 

returns the result '100 04:23:59.000000'.

Example: Converting Another string_value specified as an SQL Interval Format

The following query, which specifies an SQL interval format:

SELECT TO_DSINTERVAL('100 04:23:59.543'); 

returns the result '100 04:23:59.543000'.

Example: Converting string_value specified as an ISO Duration

The following query, which specifies an ISO duration:

SELECT TO_DSINTERVAL('P100DT4H23M59S'); 

returns the result '100 04:23:59.000000'.

Example: Converting string_value specified as an ISO Duration of 73 hours

The following query, which specifies an ISO duration of 73 hours:

SELECT TO_DSINTERVAL('PT73H'); 

returns the result '3 01:00:00.000000', which is 3 days, 1 hours.

Example: Converting string_value Error

The following query:

SELECT TO_DSINTERVAL('P2MT12H'); 

returns an error because the month designator, '2M', isn't allowed.