This Oracle tutorial explains how to use the Oracle/PLSQL NUMTODSINTERVAL function.
NumToDSInterval converts number to INTERVAL DAY TO SECOND. Its format is:
NUMTODSINTERVAL(x, interval_unit)
The syntax for the Oracle/PLSQL NUMTODSINTERVAL function is:
NUMTODSINTERVAL( number, expression )
number
is the number to convert to an interval.
expression
is the unit.
It must be DAY, HOUR, MINUTE, or SECOND.
The interval_unit may be DAY, HOUR, MINUTE, or SECOND.
SQL> SELECT NUMTODSINTERVAL(2.3, 'DAY') FROM dual;
-- from w ww . j a v a2 s . co m
NUMTODSINTERVAL(2.3,'DAY')
---------------------------------------------------------------------
+000000002 07:12:00.000000000
SQL> SELECT NUMTODSINTERVAL(1.23, 'HOUR') FROM dual;
NUMTODSINTERVAL(1.23,'HOUR')
---------------------------------------------------------------------
+000000000 01:13:48.000000000
SQL> SELECT NUMTODSINTERVAL(1, 'MINUTE') FROM dual;
NUMTODSINTERVAL(1,'MINUTE')
---------------------------------------------------------------------
+000000000 00:01:00.000000000
SQL> SELECT NUMTODSINTERVAL(99.123456789, 'SECOND') FROM dual;
NUMTODSINTERVAL(99.123456789,'SECOND')
---------------------------------------------------------------------
+000000000 00:01:39.123456789
SQL>