Examples - Teradata Vantage NewSQL Engine - 16.20

Teradata Vantageā„¢ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

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.