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

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » System Packages » dbms_job 
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.