run job every 10 days excluding weekends - dbms_job vs. dbms_scheduler
jareeqJul 1 2011 — edited Oct 19 2011Hi again,
recently switched from dbms_job to dbms_scheduler but i'm confused about complexity of the second and want to know that I'm going right way.
Task is to run job every 10 days excluding weekends but then run job first working day after weekend.
In dbms_job i'V done this using:
trunc(least(next_day(SYSDATE+10, 'PONIEDZIAŁEK'),next_day(SYSDATE+10, 'WTOREK'),next_day(SYSDATE+10, 'ŚRODA'),next_day(SYSDATE+10, 'CZWARTEK'),next_day(SYSDATE+10, 'PIĄTEK')),'DD')+9/24
(days in Polish)
that works like expected
In dbms_scheduler realy cant do it in single job definition so defined 3(!) schedules:
SAT_10 --> Freq=Daily;Interval=10;ByDay=SAT
SUN_10 --> Freq=Daily;Interval=10;ByDay=SUN
WORK_DAY_10 --> Freq=Daily;Interval=10;ByDay=Mon, Tue, Wed, Thu, Fri
and fourth schedule to combine above 3:
INT10_ONLY_WORK --> sat_10+2d,sun_10+1d,work_day_10
job is running with schedule INT10_ONLY_WORK and works like expected but like I mentioned before - I'm not sure that this is best solution - looks very complex.
Anyone has better idea (less complex) or this is right way ?
Edited by: user3656327 on 2011-07-01 02:37 (comment about daynames)