how to submit TempInsert as a job. : dbms_job « System Packages « Oracle PL / SQL






how to submit TempInsert as a job.

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

Table created.

SQL>
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 (1,
  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>
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
----------
        46

SQL>
SQL> DROP SEQUENCE temp_seq;

Sequence dropped.

SQL> drop table MyTable;

Table dropped.

SQL>
SQL>
SQL>

   
    
  








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.DBMS_JOB package.
5.Use dbms_job.submit to call 'execute immediate'
6.Remove a procedure from the queue after 5 executions.
7.Submit job to change password