Skip to main content

TRANSACTION COMMIT

Commits all changes made during the current transaction.

Synopsis

TRANSACTION COMMIT {THEN statements  | ELSE statements }

Description

The TRANSACTION COMMIT statement ends the current transaction initiated by a TRANSACTION START statement. All file changes issued during the transaction are committed, and cannot be subsequently reverted.

You must specify either a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the transaction commit is successful, the THEN clause is executed. If the transaction commit fails, the ELSE clause is executed. The statements argument can be the NULL keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line and cannot follow a THEN, ELSE, or END keyword on that line.

To revert the changes made during the current transaction, issue a TRANSACTION ABORT statement, rather than a TRANSACTION COMMIT statement.

Note:

Caché MVBasic supports two sets of transaction statements:

  • UniData-style TRANSACTION START, TRANSACTION COMMIT, and TRANSACTION ABORT.

  • UniVerse-style BEGIN TRANSACTION, COMMIT, ROLLBACK, and END TRANSACTION.

These two sets of transaction statements should not be combined.

Locks and Transactions

File locks and record locks that were taken out during a transaction are released at the end of a transaction. If there are nested transactions, the release of locks taken out during the inner transactions is delayed until the completion of the outermost transaction. This release of locks is part of a successful TRANSACTION COMMIT or TRANSACTION ABORT operation. Locks are described in the LOCK statement.

See Also

FeedbackOpens in a new tab