1 Reply Latest reply: Sep 17, 2012 10:20 AM by spajdy RSS

    Help with DBMS_JOB

    drbiloukos
      Hello people,

      I studied the documentation and many websites about DBMS_JOB but I am still confused.

      How do I schedule a procedure to run i.e. every sunday 10:00 AM ?

      This is whta I tried:
      DECLARE
        X NUMBER;
      BEGIN
        SYS.DBMS_JOB.SUBMIT
          (
            job        => X
           ,what       => 'TEST.STATS;'
           ,interval   => 'NEXT_DAY(TRUNC(SYSDATE), 'SUNDAY')+10/24'
           ,interval   => 'TRUNC(SYSDATE+1)'
           ,no_parse   => FALSE
          );
      :JobNumber := to_char(X);
      END;
      Do I need to specify a next_date ?

      Is the Interval related to next_date ?

      Thank you in advance for your help.
        • 1. Re: Help with DBMS_JOB
          spajdy
          NEXT_DATE - define 1st job run
          INTERVAL - it is formula for ORACLE engine that use it to calculate NEXT_DATE for 2nd and followings run
          after job is finished ORACLE simply run SELECT <<INTERVAL>> FROM DUAL and get NEXT_DATE.
          So for INTERVAL is valid any formula that return a DATE.