NUMTODSINTERVAL function in Oracle

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

Syntax:

NUMTODSINTERVAL ( 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 1:

NUMTODSINTERVAL(120, 'DAY')

Output:

'+000000120'

Explanation:
The result is an INTERVAL DAY TO SECOND literal.

Example 2:

NUMTODSINTERVAL(1200, 'HOUR')

Output:

'+000000050'

Explanation:
The result is an INTERVAL DAY TO SECOND literal.