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!

Autocommit and Execute Immediate

634196Oct 23 2008 — edited Oct 23 2008

Hi,

I have a main procedure which calls the same procedure do_something(f_table_name) for many tables. Now to make this dynamic table call , I used many EXECUTE IMMEDIATE stmts at my do_something(f_table_name). Due to EXECUTE IMMEDIATE stmt every instance for the statements got Auto committed. But my requirement is to commit only after fully executed all the do_something(f_table_name) for every table (example for here, after do_something(table1); do_something(table2); and do_something(table3); I want it to be committed.
Incase if there is getting some problem at do_something(table2), I want the statements executed for do_something(table1) to be rollback.

Please let me know if any idea on this. Thanks.

PROCEDURE main_process

  do_something(table1);
  do_something(table2);
  do_something(table3);

END;
PROCEDURE do_something (f_table_name VARCHAR2)

  EXECUTE IMMEDIATE ......
   |
   | 
  EXECUTE IMMEDIATE ......

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2008
Added on Oct 23 2008
4 comments
3,362 views