This Oracle tutorial explains how to use the Oracle/PLSQL NUMTODSINTERVAL function with syntax and examples.
The Oracle/PLSQL NUMTODSINTERVAL function converts a number to an INTERVAL DAY TO SECOND literal.
The syntax for the NUMTODSINTERVAL function in Oracle/PLSQL is:
NUMTODSINTERVAL( number, expression )
The number to convert to an interval.
The unit to convert to. It must be one of the following values: DAY, HOUR, MINUTE, or SECOND.
The NUMTODSINTERVAL function returns an INTERVAL DAY TO SECOND value.
The NUMTODSINTERVAL function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle NUMTODSINTERVAL function examples and explore how to use the NUMTODSINTERVAL function in Oracle/PLSQL.
For example:
NUMTODSINTERVAL(150, 'DAY')
Output: '+000000150'
NUMTODSINTERVAL(1500, 'HOUR')
Output: '+000000062'
NUMTODSINTERVAL(15000, 'MINUTE')
Output: '+000000010'
NUMTODSINTERVAL(150000, 'SECOND')
Output: '+000000001'