Oracle Scheduled Tasks

Source: Internet
Author: User

1), per minute execution

Execute every Minute

TRUNC (sysdate, ' mi ') + 1/(24*60)

Executes every five minutes

TRUNC (sysdate, ' mi ') + 5/(24*60)

2), hourly execution

Hourly execution

TRUNC (sysdate, ' mi ') + 1/24

Executes every five hours

TRUNC (sysdate, ' mi ') + 5/24

3), per day execution

Daily 2 o'clock in the morning execution

TRUNC (sysdate) + 1 +2/(24)

Example: every 5 days 2 o'clock in the morning execution

TRUNC (sysdate) + 5 +2/(24)

4), per week execution

Executed every Monday 2 o'clock in the morning

TRUNC (Next_day (sysdate,2)) +2/24-Monday (second day of the week)

Executed every Saturday 2 o'clock in the morning

TRUNC (Next_day (sysdate,7)) +2/24-Saturday (Seventh day of the week)

5), monthly execution

1st 2 o'clock in the morning monthly execution

TRUNC (Last_day (sysdate)) +1+2/24

5th 10 o'clock in the morning monthly execution

TRUNC (Last_day (sysdate)) +5+10/24

6), quarterly execution

2 o'clock in the morning on the first day of each quarter

TRUNC (Add_months (sysdate,3), ' Q ') + 2/24

7), every half-yearly scheduled execution

Every July 1 and January 1 2 o'clock in the morning

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 to execute every year

Executed every January 1 2 o'clock in the morning

Add_months (TRUNC (sysdate, ' yyyy '), 12) +2/24

Add:

1.

Next_day (D,number)

--Starting point D, the date of the next one weeks

--Sunday: 1, Monday: 2, Tuesday: 3, Wednesday: 4, Thursday: 5, Friday: 6, Saturday: 7

2.

Add_months (D,n)

--Return point D plus n months

3.

Last_day (d)

--point in time d the last day of the month

4.

TRUNC (D[,fmt])

--Interception of dates

--for example, the current time is: 2012-08-06-04:39:00

SELECT TRUNC (sysdate, ' mm ') from dual

--Return to the first day of the month of 2012-8-1

SELECT TRUNC (sysdate, ' yy ') from dual

--Return to the first day of the year 2012-1-1

SELECT TRUNC (sysdate, ' DD ') from dual

--Return to the 2012-8-6 day

SELECT TRUNC (sysdate, ' Day ') from dual

--Return to the first day of the week in 2012-8-5

SELECT TRUNC (sysdate) from dual

--return 2012-8-6 not fill in the parameters is the default is the day

SELECT TRUNC (sysdate, ' hh ') from dual

--Return 2012-8-6 04:00:00 current hour

SELECT TRUNC (sysdate, ' mi ') from dual

--return 2012-8-6 04:39:00 current minute

Original address: 51335871

Oracle Scheduled Tasks

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.