DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: dbms_job intervals

Threaded View

  1. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Code:
    TRUNC(LEAST(NEXT_DAY(SYSDATE, 'MONDAY'),
                NEXT_DAY(SYSDATE, 'TUESDAY'),
                NEXT_DAY(SYSDATE, 'WEDNESDAY'),
                NEXT_DAY(SYSDATE, 'THURSDAY'),
                NEXT_DAY(SYSDATE, 'FRIDAY')))
    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:
    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;
    Last edited by jmodic; 11-12-2002 at 04:00 PM.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width