Skip to Main Content

Oracle Database Discussions

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!

RollBack part (not entire) of transaction.

DanckoSep 4 2016 — edited Sep 5 2016

Hi to all,

There exists a way for rollback only a part of transaction and not all the entire transaction?

For example I have the following situation:

begin

     savepoint noIns;

     FOR rRecords IN (SELECT *

                                     FROM TableA)

     LOOP
          begin
               insert into TableB (field_1) values (rRecord.field_1);
          exception
               when dup_val_on_index then
                    rollback to noIns; 
          end;

        UPDATE TableA

                SET field_2 = 'OK'

     end loop;

end;

  

If happen the DUP_VAL_ON_INDEX exception I  want to rollback only the rows inserted in the TableB, while the rows updated in TableA must not rollback.

There exists a way for to do this?

Thanks in advance!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2016
Added on Sep 4 2016
7 comments
1,173 views