Oracle PL/SQL - PL SQL SQL Statement Adding Savepoints

Introduction

You may create multiple savepoints in the same transaction.

You will lose any transactions made after the specified one.

begin
    update ...;                                              
     Savepoint A;                                            
    update ...;                                              
     Savepoint B;                                            
    update ...;                                              
     if condition then                                       
      rollback to savepoint A;                               
   end if;
   commit;
end;

If you do use multiple savepoints in one transaction, give all savepoints unique, descriptive names.

Rolling back to a savepoint only discards changes to the database; it does not undo any changes you made to local PL/SQL variables.

Related Topic