Convert number to interval in oracle using NUMTODSINTERVAL function
By Santhosh N
This explains how to convert the given number to the interval (which can be days, hours, minutes, or seconds) in the oracle using the NUMTODSINTERVAL conversion function
There is a conversion function in oracle by the name, NUMTODSINTERVAL which converts the specified number to the desired interval. The interval can be
either of day, hour, minute or second.
Syntax: NUMTODSINTERVAL(n, Interval)
Here n is the number to be converted, and Interval is the unit that’s needs to be converted to and its values can be DAY, HOUR, MINUTE, or SECOND.
Ex1: SELECT NUMTODSINTERVAL(10,'MINUTE') FROM dual;
This returns “+00 00:10:00.000000” as result
Ex2: SELECT NUMTODSINTERVAL(1000,'MINUTE') FROM dual;
This returns “+00 16:40:00.000000” as result
Ex3: SELECT NUMTODSINTERVAL(1000,'HOUR') FROM dual;
This returns “+41 16:00:00.000000” as result
Related FAQs
This explains how to convert the bit vector to a number in the oracle using the BIN_TO_NUM conversion function.
This explains how to convert the the given date or integer values to strings.
This explains how to convert the string to date format in oracle.
This explains how to replace the part(s) of the string with other string or char
This explains how to convert all the characters to the upper case alphabets
This explains how to convert all the characters to the lower case alphabets
Convert number to interval in oracle using NUMTODSINTERVAL function (7502 Views)