Purpose
NUMTOYMINTERVAL() converts n 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 | An expression of the NUMBER data type or a data type that can be implicitly converted to the NUMBER data type. |
| interval_unit | The unit of the return value. Valid value: YEAR or MONTH. It is case-insensitive. |
Return type
The return type is INTERVAL YEAR TO MONTH.
Examples
The following example returns the date three years after the current date.
obclient> SELECT SYSDATE,SYSDATE+NUMTOYMINTERVAL(3,'YEAR') AS RES FROM DUAL;
+-----------+-----------+
| SYSDATE | RES |
+-----------+-----------+
| 18-NOV-21 | 18-NOV-24 |
+-----------+-----------+
1 row in set