RELEASE SAVEPOINT statement

If you don’t need any longer a specific savepoint it’s possible to release the savepoint with the RELEASE SAVEPOINT statement.

Syntax:

 RELEASE [TO] SAVEPOINT <savepointname>

Example:

 create procedure savepoints
 begin  
   insert into test values ('1st Insert');
   savepoint mysavepoint on rollback retain cursors; 
   insert into test values ('2nd Insert');

   release savepoint mysavepoint;

   rollback to savepoint mysavepoint;
 end!

Test of this example:

 call savepoints;

Result:

You will get an runtime error (SQL0880N) because the savepoint mysavepoint is not available in during the rollback statement is executed.

 


Link to the DB2 Information Center: DB2 9.7 DB2 10.1 DB2 10.5