16.20.16.20 - 16.20 - Examples - Teradata Vantage NewSQL Engine

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_YMINTERVAL('04-10'); 

returns the result '04-10'.

Example: Converting string_value Specified as an ISO duration

The following query, which specifies an ISO duration:

SELECT TO_YMINTERVAL('P100Y4M'); 

returns the result '100-04', which is 100 years, 4 months.

Example: string_value Error

The following query:

SELECT TO_YMINTERVAL('P20Y3M4DT12H23M34.234S');

returns an error because only the P, Y, and M designators are allowed.

Example: Converting string_value Specified as an ISO duration of -14 months

The following query, which specifies an ISO duration of -14 months:

SELECT TO_YMINTERVAL('-P14M'); 

returns the result '-01-02', which is negative 1 year, 2 months.