The NUMTODSINTERVAL function in Oracle SQL / PLSQL is used to convert any number to an Interval Day to Second Literal.
Syntax for the NUMTODSINTERVAL function in Oracle SQL / PLSQL is:
SELECT NUMTODSINTERVAL(number,expression)
FROM table_name;
- ‘number’ is the number to be converted to interval
- ‘expression’ is the unit and can have the following values: ‘DAY’, ‘HOUR’, ‘MINUTE’ OR ‘SECOND’
Example 1:
SELECT NUMTODSINTERVAL(250, 'DAY') FROM DUAL;
May return “+250 00:00:00.000000”
Example 2:
SELECT NUMTODSINTERVAL(2500, 'HOUR') FROM DUAL;
May return “+104 04:00:00.000000”
Example 3:
SELECT NUMTODSINTERVAL(25000, 'MINUTE') FROM DUAL;
May return “+17 08:40:00.000000”
Example 4:
SELECT NUMTODSINTERVAL(250000, 'SECOND') FROM DUAL;
May return “+02 21:26:40.000000”