Examples - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
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.