Previous Topic Next topic Print topic


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---ROLLBACK----.--------------.------------->
                            +-WORK---------+
                            +-TRAN---------+  
                            +-TRANSACTION--+

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

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
Previous Topic Next topic Print topic