All Products
Search
Document Center

NUMTODSINTERVAL

Last Updated: Jun 18, 2021

The NUMTODSINTERVAL function converts the n parameter value to a value of the INTERVAL DAY TO SECOND data type. The interval_unit parameter specifies the unit of the result value.

Syntax

NUMTODSINTERVAL (n,interval_unit)

Parameters

Parameter

Description

n

The value of the NUMBER data type.

interval_unit

Valid values for the unit: DAY, HOUR, MINUTE, and MINUTE.

Return type

INTERVAL DAY TO SECOND data type

Examples

In the following example, the statement returns a datetime value and the value indicates the date and time that is 3 hours after the current date:

SELECT SYSDATE,SYSDATE+NUMTODSINTERVAL(3,'HOUR') AS RES FROM DUAL;

The following query result is returned:

+---------------------+---------------------+
| SYSDATE             | RES                 |
+---------------------+---------------------+
| 2020-03-08 16:01:40 | 2020-03-08 19:01:40 |
+---------------------+---------------------+