Action | Interval Time | |
Execute daily | 'SYSDATE + 1' | |
Execute every 4 hours | 'SYSDATE + 4/24' | |
Execute every 10 minutes | 'SYSDATE + 10/1440' | |
Execute every 30 seconds | 'SYSDATE + 30/86400' | |
Execute every 7 days | 'SYSDATE + 7' | |
Do no re-execute and remove job | NULL |
Jobs with type 2 execution requirements involve more complex interval date expressions, as see in the following table.
Action | Interval Time |
Every day at 12:00 midnight | TRUNC(SYSDATE + 1) |
Every day at 8:00 p.m. | TRUNC(SYSDATE + 1) + 20/24 |
Every Tuesday at 12:00 noon | NEXT_DAY(TRUNC(SYSDATE), "TUESDAY") + 12/24 |
First day of the month at midnight | TRUNC(LAST_DAY(SYSDATE) + 1) |
Last day of the quarter at 11:00 p.m. | TRUNC(ADD_MONTH(SYSDATE + 2/24,3),'Q') - 1/24 |
Every Monday, Wednesday and Friday at 9:00 p.m. | TRUNC(LEAST(NEXT_DAY(SYSDATE, "MONDAY"), NEXT_DAY(SYSDATE, "WEDNESDAY"), NEXT_DAY(SYSDATE, "FRIDAY"))) + 21/24 |
WHERE RD.DATE_CREATED >= (TRUNC(ADD_MONTHS(SYSDATE,-1),'MM') + 19) AND RD.DATE_CREATED <= (TRUNC(SYSDATE ,'MM') + 19) -- Between 20th of current and previous month
SELECT
TO_CHAR((NEXT_DAY(TRUNC(SYSDATE-14), 'MONDAY') + 0 ), 'DD-MON-YYYY HH24:MI:SS') AS "Last2L Monday" ,
TO_CHAR((NEXT_DAY(TRUNC(SYSDATE-7), 'MONDAY') + 0 ), 'DD-MON-YYYY HH24:MI:SS') AS "Last Monday"
FROM DUAL; --- between last to Mondays
No comments:
Post a Comment