Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Scheduling Jobs - with out commit records are getting inserted

SuriNov 12 2013 — edited Nov 12 2013

Hi Experts,

Oracle DB Version - 11g XE

I scheduled a job using dbms_scheduler which will insert a record into table T for each minute. I didnt mention COMMIT inside my procedure but records are being commited after each successful execution. How come it is possible.

Here is my code.

SQL> create table t ( empno number, creation_date date);

Table created

SQL> create or replace procedure test_proc
  2  is
  3 
  4  begin
  5 
  6    insert into t values (1,sysdate);
  7 
  8  end;
  9  /

Procedure created

SQL> BEGIN
  2  DBMS_SCHEDULER.CREATE_JOB (
  3     job_name             => 'test_job',
  4     job_type             => 'PLSQL_BLOCK',
  5     job_action           => 'BEGIN test_proc; END;',
  6     start_date           => cast(sysdate as timestamp with time zone),
  7     repeat_interval      => 'FREQ=MINUTELY',
  8     end_date             => cast(sysdate+1 as timestamp with time zone),
  9     enabled              =>  TRUE,
10     comments             => 'insert record into table t');
11  END;
12  /

PL/SQL procedure successfully completed

SQL> select * from t;

     EMPNO CREATION_DATE
---------- -------------
         1 11/12/2013 11
         1 11/12/2013 11
         1 11/12/2013 11
         1 11/12/2013 11
         1 11/12/2013 12
         1 11/12/2013 12
         1 11/12/2013 12
         1 11/12/2013 12
         1 11/12/2013 12

9 rows selected

Cheers,

Suri

This post has been answered by BluShadow on Nov 12 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2023
Added on Nov 12 2013
22 comments
6,448 views