SAVEPOINT [ ALLBASE/SQL Reference Manual ] MPE/iX 5.5 Documentation
ALLBASE/SQL Reference Manual
SAVEPOINT
The SAVEPOINT statement defines a savepoint within a transaction.
DBEnvironment changes made after a savepoint can be undone at any time
prior to the end of the transaction. A transaction can have multiple
savepoints.
Scope
ISQL or Application Programs
SQL Syntax
[:HostVariable ]
SAVEPOINT [:LocalVariable ]
[:ProcedureParameter]
Parameters
[REV BEG]
HostVariable identifies an output host variable used to
communicate the savepoint number. The host
variable's value can be from 1 to (231)-1.[REV
END] In an application program, you must use a
host variable with the SAVEPOINT statement. In a
procedure, you must use either a local variable
or a procedure parameter with the SAVEPOINT
statement.
When you enter a SAVEPOINT statement
interactively, you cannot specify a host
variable. ISQL assigns and displays the
savepoint number as follows:
isql=> savepoint;
Savepoint number is n.
Use this number to do ROLLBACK WORK to n.
[REV BEG]
LocalVariable contains a value in a procedure. Identifies an
output host variable used to communicate the
savepoint number. The host variable's value can
be from 1 to (231)-1.
ProcedureParameter contains a value that is passed into or out of a
procedure. Identifies an output host variable
used to communicate the savepoint number. The
host variable's value can be from 1 to
(231)-1.[REV END]
Description
* Specify the savepoint number in the TO clause of a ROLLBACK WORK
statement to roll back to a savepoint.
* If a procedure invoked by a rule executes a COMMIT WORK statement,
an error occurs.
Authorization
You do not need authorization to use the SAVEPOINT statement.
Example
Transaction begins.
BEGIN WORK
statement-1
SAVEPOINT :MyVariable
statement-2
statement-3
Work of statements 2 and 3 is undone.
ROLLBACK WORK
TO :MyVariable
Work of statement-1 is committed; transaction ends.
COMMIT WORK
MPE/iX 5.5 Documentation