numtodsinterval (<x>,<c>) , X is a number, C is a string,
indicates the unit of X, which shifts the x to the interval day to second data typecommon units are (' Day ', ' hour ', ' minute ', ' second ')Examplesql> Select Sysdate,sysdate+numtodsinterval (3, ' Hour ') as res from dual;sysdate RES--------------------------------------2007-09-05 01:45:34 2007-09-05 04:45:34
Numtoyminterval is similar to the Numtodsinterval function, converting x to the interval year to month data typecommonly used units have ' year ', ' Month 'Examplesql> Select Sysdate,sysdate+numtoyminterval (3, ' year ') as res from dual;sysdate RES--------------------------------------2007-09-05 01:54:53 2010-09-05 01:54:53
--------------------------------------------------------------------------------------------------------------- --------
format: Numtoyminterval (n, interval_unit);N: Numeric typeinterval_unit: ' year ', ' MONTH ', or other expression that can be converted to one of these two values numtoyminterval (1, ' Year '): The interval after one yearsnumtoyminterval ( -1, ' month '): One months ago decimals are counted as integers, and then the calculation is done: Select Sysdate + numtoyminterval (0.1, ' MONTH ') as the future from dual;\ Future------------------11-oct-13 The result of this function is: "INTERVAL year to MONTH literal". cannot be operated with numeric values. Select 1 + numtoyminterval (1, ' MONTH ') from dualOracle will return an error. This function is useful when you are doing a date operation. For example: Date after one months:Select Sysdate + numtoyminterval (1, ' MONTH ') from dual;
Oracle Compute Time Functions (Numtodsinterval, Numtoyminterval)