ALLBASE/SQL Reference Manual (36216-90216)

Chapter 11 495
SQL Statements E - R
ROLLBACK WORK
ROLLBACK WORK
The ROLLBACK WORK statement undoes changes you have made to the DBEnvironment
during the current transaction, releases locks held by the transaction, and closes cursors
opened during the transaction. Other transactions active in this session are not affected.
Scope
ISQL or Application Programs
SQL Syntax
ROLLBACK WORK [TO {
SavePointNumber
:
HostVariable
:
LocalVariable
:
ProcedureParameter
}
RELEASE ]
Parameters
TO The TO clause is used to roll back to a savepoint without ending the
current transaction.
If the TO clause is omitted, ROLLBACK WORK ends the current transaction
and undoes any changes that have been made in the transaction.
SavePointNumber
is the number assigned by ISQL to a savepoint when you issue the
SAVEPOINT statement interactively.
HostVariable
is defined as an integer variable to which you assign a value when you
issue the SAVEPOINT statement programmatically, or in a procedure.
LocalVariable
contains a value in a procedure.
ProcedureParameter
contains a value that is passed into or out of a procedure.
RELEASE terminates your DBE session.
Description
When you omit the TO clause, all changes you have made to the DBEnvironment since
the most recent BEGIN WORK statement are undone. In an application program, all open
cursors are automatically closed except those opened with the KEEP CURSOR option.
Any savepoints defined in the transaction are lost and become invalid. The transaction
is ended. Any cursor opened with the KEEP CURSOR option is repositioned to its scan
position as of the most recent BEGIN WORK statement, and a new transaction is
implicitly started with the same isolation level.
The TO clause may not be used if any cursors that were opened with the KEEP
CURSOR option are still open. Issuing a ROLLBACK WORK to a savepoint in this context
results in an error message, and no rollback is done.
When you specify the TO clause, all changes you have made to the DBEnvironment