Oracle job timer execution interval learning Summary

Source: Internet
Author: User


Oracle job timer execution interval learning summary Oracle job timer execution interval is also the key settings of the timer job, in this setting, has not been mastered, always do not know how to write, the following is a summary of the usage of functions such as TRUNC, NEXT_DAY, ADD_MONTHS, and LAST_DAY. 1) execute Interval => TRUNC (sysdate, 'mi') + 1/(24*60) per minute -- view the time select TRUNC (sysdate, 'mi ') + 1/(24*60) from dual; -- Extension: www.2cto.com --- execute Interval => TRUNC (sysdate, 'mi ') + 5/(24*60) every five minutes) select TRUNC (sysdate, 'mi') + 5/(24*60) from dual; 2), execute Interval => TRUNC (sysdate, 'mi') every hour ') + 1/24 select TRUNC (sysdate, 'mi') + 1/24 from dual; -- extended: --- execute Interval => TRUNC (sysdate, 'mi') every five hours ') + 5/24 select TRUNC (sysdate, 'mi ') + 5/24 from dual; 3) scheduled daily execution example: Execute Interval => TRUNC (sysdate) at every day) + 1 + 2/(24) select TRUNC (sysdate) + 1 + 2/(24) from dual; example: execute Interval => TRUNC (sysdate) + 5 + 2/(24) select TRUNC (sysdate) + 5 + 2/(24) from dual at every five days; www.2cto.com 4) and periodical weekly execution. Example: Execute Interval => TRUNC (next_day (sysdate, 2) + 2/24 every Monday (the second day of the week) at every Monday) select TRUNC (next_day (sysdate, 2) + 2/24 from dual; for example, execute Interval => TRUNC (next_day (sysdate, 7) at every Saturday )) + 2/24 -- On Saturday (the seventh day of the week) select TRUNC (next_day (sysdate, 7) + 2/24 from dual; 5), scheduled monthly execution for example: interval => TRUNC (LAST_DAY (SYSDATE) + 1 + 2/24 select TRUNC (LAST_DAY (SYSDATE) + 1 + 2/24 from dual; example: execute Interval => TRUNC (LAST_DAY (SYSDATE) + 5 + 10/24 select TRUNC (LAST_DAY (SYSDATE) + 5 + 10/24 from dual; 6) at ten o'clock A.M. every month) periodical execution on a quarterly basis. For example, Interval => TRUNC (ADD_MONTHS (SYSDATE, 3), 'q') + 2/24 select TRUNC (ADD_MONTHS (SYSDATE, 3), 'q') + 2/24 from dual; www.2cto.com 7), scheduled execution every six months, for example: every year on January 1, and Interval => ADD_MONTHS (trunc (sysdate, 'yyyy'), 6) + 2/24 select trunc (sysdate, 'yyyy') from dual; select ADD_MONTHS (trunc (sysdate, 'yyyy'), 6) from dual; 8) scheduled execution every year. For example, execute Interval => ADD_MONTHS (trunc (sysdate, 'yyyy'), 12) + 2/24 at on January 1, NEXT_DAY (d, number) -- start at time d, date of the next day of the week -- Sunday = 1, Monday = 2, Tuesday = 3, wedday = 4, Thursday = 5, Friday = 6, saturday = 7 2, ADD_MONTHS (d, n) -- return time point d plus n months 3, LAST_DAY (d) -- time point d when the last day of the month www.2cto.com 4, TRUNC (d [, fmt]) -- cut the date -- for example, the current time is: 04:39:00 SELECT trunc (sysdate, 'mm') FROM dual -- returns SELECT trunc (sysdate, 'yy') FROM dual on the first day of the current month FROM 2012-8-1 -- returns SELECT trunc (sysdate, 'dd') on the first day of the current year on 2012--1 ') FROM dual -- Return SELECT trunc (sysdate, 'day') FROM dual on 2012-8-6 -- Return SELECT trunc (sysdate) on 2012-8-5 on the first day of the week) FROM dual -- returns 2012-8-6. If no parameter is specified, the default value is SELECT trunc (sysdate, 'hh') FROM dual on the current day. -- returns SELECT trunc (sysdate, 'mi ') at 04:00:00 on the afternoon of 2012-8-6 ') FROM dual -- returns the author lsxy117 FROM 04:39:00 current minute

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.