Run agent on last business day of the month

How to schedule the agent that run only on last business day of the month

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Keep up to date on this post and subscribe to comments

April 16, 2010 - 12:54pm

If it doesn't matter that your agent runs everyday, then you might want to have some precondition set in your agent activity to check if the current date is the last business day ( logic using the business calendar functions) and then exit the activity without any processing except for the last business day.
To make this work i believe you should be on 5.4 or above and use a recurring agent that runs everyday.

April 20, 2010 - 5:37pm

I agree with KOTAS. Here is an example for the *first* day of the month, almost what you want:


April 20, 2010 - 6:17pm

If you are using Oracle 10g you could get the last business day using this SQL

SELECT MAX(business_date) as LastBusinessDay
FROM ((SELECT TO_DATE(TO_CHAR(trunc(SYSDATE,'MM'),'dd-MON-yyyy'), 'dd-MON-yyyy')
- 1 business_date
TO_DATE (TO_CHAR(LAST_DAY(SYSDATE),'dd-MON-yyyy'), 'dd-MON-yyyy')
- TO_DATE (TO_CHAR(trunc(SYSDATE,'MM'),'dd-MON-yyyy'), 'dd-MON-yyyy')
+ 1))
WHERE TO_CHAR (business_date, 'DY') NOT IN ('SAT', 'SUN');

Hope this helps.