SAVEPOINT
Valid in: SQL, ESQL, OpenAPI, JDBC
The SAVEPOINT statement declares a named savepoint marker within a transaction. Savepoints can be used in conjunction with the ROLLBACK statement to roll back a transaction to the specified savepoint when necessary. Using savepoints can eliminate the need to roll back an entire transaction if it is not necessary.
Note: This statement has additional considerations when used in a distributed environment. For more information, see the Ingres Star User Guide.
The SAVEPOINT statement has the following format:
[EXEC SQL] SAVEPOINT savepoint_name;
savepoint_name
Defines the name of the savepoint. The name can be any unquoted character string conforming to rules for object names, except that the first character need not be alphabetic. This enables numeric savepoint names to be specified.
Any number of savepoints can be declared within a transaction, and the same savepoint_name can be used more than once. However, if the transaction is aborted to a savepoint whose name is used more than once, the transaction is backed out to the most recent use of the savepoint_name.
All savepoints of a transaction are rendered inactive when the transaction is terminated (with either a COMMIT, a ROLLBACK, or a system intervention upon deadlock). For more information on deadlock, see
COMMIT and
ROLLBACK and the chapter “Working with Transactions and Handling Errors.”
Embedded Usage
An embedded SAVEPOINT statement cannot be issued when a cursor is open. Savepoint_name cannot be specified with a host language variable.
Usage in OpenAPI, JDBC
In OpenAPI, SAVEPOINT functionality is achieved through IIapi_savePoint(). In JDBC, applications should use the interface-specific mechanism for SAVEPOINT.
Permissions
This statement is available to all users.
Related Statements
COMMIT
ROLLBACK
Last modified date: 08/29/2024