DBMS_JOB package. : dbms_job « System Packages « Oracle PL / SQL






DBMS_JOB package.

   
SQL>
SQL> CREATE TABLE MyTable (
  2    num_col    NUMBER,
  3    char_col   VARCHAR2(60)
  4    );

Table created.

SQL> CREATE SEQUENCE temp_seq
  2    START WITH 1
  3    INCREMENT BY 1;

Sequence created.

SQL>
SQL> CREATE OR REPLACE PROCEDURE TempInsert AS
  2  BEGIN
  3    INSERT INTO MyTable (num_col, char_col)
  4      VALUES (temp_seq.NEXTVAL,
  5              TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS'));
  6    COMMIT;
  7  END TempInsert;
  8  /

Procedure created.

SQL>
SQL> VARIABLE v_JobNum NUMBER
SQL> BEGIN
  2    DBMS_JOB.SUBMIT(:v_JobNum, 'TempInsert;', SYSDATE,
  3                    'SYSDATE + (90/(24*60*60))');
  4    COMMIT;
  5  END;
  6  /

PL/SQL procedure successfully completed.

SQL>
SQL> PRINT v_JobNum

  V_JOBNUM
----------
        22

SQL>
SQL> BEGIN
  2    DBMS_JOB.REMOVE(:v_JobNum);
  3    COMMIT;
  4  END;
  5  /

PL/SQL procedure successfully completed.

SQL>
SQL>
SQL> DROP SEQUENCE temp_seq;

Sequence dropped.

SQL>
SQL> drop table mytable;

Table dropped.

   
    
  








Related examples in the same category

1.Simple Procedure with SUBMIT
2.Using DBMS_OUTPUT to See the Assigned Job Number
3.Using the SUBMIT Procedure
4.Use dbms_job.submit to call 'execute immediate'
5.Remove a procedure from the queue after 5 executions.
6.how to submit TempInsert as a job.
7.Submit job to change password