TO YMINTERVAL

From Oracle FAQ
Jump to: navigation, search

The TO_YMINTERVAL function converts a string in format 'Y[Y...]-M[M]' into an INTERVAL YEAR TO MONTH datatype.

The first part Y[Y...] contains 1 to 9 figures indicating the number of years from 0 to 999999999. The second part M[M] contains 1 or 2 figures indicating the number of months between 0 and 11.

SQL> select TO_YMINTERVAL('01-02') from dual;
TO_YMINTERVAL('01-02')
---------------------------------------------
+000000001-02