The NUMTOYMINTERVAL function converts the n parameter value to a value of the INTERVAL YEAR TO MONTH data type in the unit specified by interval_unit.
Syntax
NUMTOYMINTERVAL (n,interval_unit)
Parameters
| Parameter | Description |
|---|---|
| n | A value of the NUMBER data type. |
| interval_unit | The unit. Valid values: YEAR and MONTH. |
Return type
The return type is INTERVAL YEAR TO MONTH.
Examples
In the following example, a date and time value that is three years after the current date is returned:
SELECT SYSDATE,SYSDATE+NUMTOYMINTERVAL(3,'YEAR') AS RES FROM DUAL;
The following result is returned:
+---------------------+---------------------+
| SYSDATE | RES |
+---------------------+---------------------+
| 2020-03-08 16:03:58 | 2023-03-08 16:03:58 |
+---------------------+---------------------+