ROLLBACK

Backs out any changes made to the database by the current transaction on the current connection, or partially rolls back changes to a previously set save point.

Syntax:

>>---EXEC SQL---.------------.--->
                +-AT db_name-+

 >--ROLLBACK----.--------------.--------->
                +-WORK---------+
                +-TRAN---------+  
                +-TRANSACTION--+

 >---.-----------.---END-EXEC---><  
     +--RELEASE--+
     +--TO-.-----------.-name--+
           +-SAVEPOINT-+

Parameter:

AT db_name The name of a database that has been declared using DECLARE DATABASE. This clause is optional. If omitted, the current connection is rolled back. If provided, and the connection specified is different than the current connection, the rollback is performed on the connection associated with the DECLARE CURSOR statement.

Comments:

When RELEASE is specified and the transaction is successfully rolled back, the current connection is closed.

TO [SAVEPOINT] rolls the transaction back just to the save point specified by name, which must be set by a preceding SAVEPOINT statement.

Example:

EXEC SQL
   ROLLBACK
END-EXEC

EXEC SQL
    ROLLBACK WORK RELEASE
END-EXEC

END-EXEC

EXEC SQL
    ROLLBACK TO SP1
END-EXEC