8. SQL Statements : SAVEPOINT : Syntax
 
Share this page                  
Syntax
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 (see COMMIT) and Rollback (see ROLLBACK) and the chapter “Working with Transactions and Handling Errors.”