savepoint

Mark a transaction savepoint

Syntax

savepoint_stmt:
          SAVEPOINT savepoint_id

Description

The SAVEPOINT statement is used to mark a transaction savepoint identified by savepoint_id that can be the target of a subsequently executed ROLLBACK [TO SAVEPOINT] savepoint_id statement which will cause all of the database modifications made after this savepoint to be discarded while keeping intact all changes made in the transaction prior to this savepoint.

Of course, this statement requires that a transaction has been started.

Savepoints are discarded through execution of a RELEASE SAVEPOINT statement, a ROLLBACK to a prior savepoint, or a ROLLBACK or COMMIT of the transaction.

Example

start trans;
insert into acctmgr ... new account manager
savepoint new_patron;
insert into patron ... new patron for new acct manager
insert into patron ... another for the new acct manager
	... discover problem with new patrons
rollback savepoint to new_patron;
commit;

See Also

RELEASE SAVEPOINT

ROLLBACK