Oracle computing time functions (numtodsinterval, numtoyminterval), oracle computing functions

Source: Internet
Author: User

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;

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.