Skip to content

TO_YMINTERVAL

SELECT TO_YMINTERVAL('02-05') FROM DUAL;
+-------------------+
| TO_YMINTERVAL('02-05') |
+-------------------+
| +02-05 |
+-------------------+

The TO_YMINTERVAL function converts a string of YYYY-MM format into an INTERVAL YEAR TO MONTH literal. In the given query, ‘02-05’ is transformed to an interval of 2 years and 5 months. It returns the equivalent INTERVAL YEAR TO MONTH value.