Oracle Date/Time Function - Oracle/PLSQL NUMTOYMINTERVAL Function






This Oracle tutorial explains how to use the Oracle/PLSQL NUMTOYMINTERVAL function.

NUMTOYMINTERVAL converts the number x to an INTERVAL YEAR TO MONTH. The syntax for the numtoyminterval function is:

numtoyminterval( number, expression )

number is the number to convert to an interval. expression is the unit. It must be one of the following values: YEAR or MONTH.

Syntax

The syntax for the Oracle/PLSQL NUMTOYMINTERVAL function is:

NUMTOYMINTERVAL( number, expression )

number is the number to convert to an interval.

expression is the unit which must be YEAR or MONTH.

Example


SQL> select numtoyminterval(10, 'MONTH') from dual;
-- from   w  ww .  jav  a  2  s.  c  om
NUMTOYMINTERVAL(10,'MONTH')
------------------------------------------------------
+000000000-10

SQL> select numtoyminterval(100, 'YEAR') from dual;

NUMTOYMINTERVAL(100,'YEAR')
------------------------------------------------------
+000000100-00

SQL>