This expression will return you the next working day's date. If you run it on Monday through Thursday it wil simply return you the next day, while on Friday, Saturday or Sunday it will return you the next Monday's date. If you are not to comfortable with this piece of code, you can rewrite it using a DECODE:Code:TRUNC(LEAST(NEXT_DAY(SYSDATE, 'MONDAY'), NEXT_DAY(SYSDATE, 'TUESDAY'), NEXT_DAY(SYSDATE, 'WEDNESDAY'), NEXT_DAY(SYSDATE, 'THURSDAY'), NEXT_DAY(SYSDATE, 'FRIDAY')))
Code:DECLARE jobno NUMBER; BEGIN dbms_job.submit(jobno ,'MY_PACKAGE.MY_JOB;' ,SYSDATE ,'TRUNC(DECODE(TO_CHAR(SYSDATE,'DAY'), ''FRIDAY'', SYSDATE+3, ''SATURDAY'', SYSDATE+2, SYSDATE+1 ) )+7/24' ); END;




Reply With Quote