Oracle computing time functions (numtodsinterval, numtoyminterval), oracle computing functions
Numtodsinterval (<x>, <c>), X is a number, and c is a string,
Indicates the unit of x. This function converts x to interval day to second. Commonly Used units include ('day', 'hour', 'minute ', 'second ') example SQL> select sysdate, sysdate + numtodsinterval (3, 'hour ') as res from dual; SYSDATE RES ----------------------------------- 01:45:34
NumtoymintervalSimilar to the numtodsinterval function, commonly used units for converting x to interval year to month data types include 'Year', 'month' exampleSQL> select sysdate, sysdate + numtoyminterval (3, 'Year ') as res from dual; sysdate res ----------------- ----------------------- 01:54:53 2010-09-05 01:54:53
Bytes -----------------------------------------------------------------------------------------------------------------------
Format: NumToYMInterval (n, interval_unit); n: Value Type: interval_unit: 'Year', 'month', or other expressions that can be converted to one of the two values NumToYMInterval (1, 'Year'): interval after one YEAR NumToYMInterval (-1, 'month'): the decimal number before a MONTH is calculated as an integer, and then calculated: select sysdate + numtoyminterval (0.1, 'month') as future from dual; \ the result of the FUTURE------------------11-OCT-13 for this function is: "interval year to month literal". It cannot be computed with a value. Select 1 + NumToYMInterval (1, 'month') from dualOracle will return an error. This function is very useful when performing date operations. For example, take the date after one MONTH: select sysdate + NumToYMInterval (1, 'month') from dual;