NUMTOYMINTERVAL function in Oracle

NUMTOYMINTERVAL is one of the vital Conversion functions of Oracle. It is used to convert a number to an INTERVAL YEAR TO MONTH literal. The NUMTOYMINTERVAL function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

NUMTOYMINTERVAL ( number, expression )

Parameters:
number: It is used to specify the number to be converted.
expression: It is used to specify the unit to be converted to.

Example:

NUMTOYMINTERVAL(200000, 'YEAR')

Output:

'+0002'

Explanation:
The result is an INTERVAL YEAR TO MONTH literal.

Example:

NUMTOYMINTERVAL(200000000, 'MONTH')

Output:

'+0166'

Explanation:
The result is an INTERVAL YEAR TO MONTH literal.