Examples - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

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.