TO_YMINTERVAL Examples - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

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.