Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Begins a transaction.
TRANSACTION START {THEN statements | ELSE statements}
The TRANSACTION START statement initiates a transaction. There is no command to demarcate the end of a transaction. All subsequent statements are part of this transaction until the transaction is closed, either by a TRANSACTION COMMIT statement or a TRANSACTION ABORT statement. If neither a TRANSACTION COMMIT nor a TRANSACTION ABORT is issued, the transaction remains open until the end of the program, at which time it is automatically rolled back.
You must specify either a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the transaction start is successful, the THEN clause is executed. If the transaction start 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.
You can use multiple TRANSACTION START statements to create nested transactions.
Caché MVBasic supports two sets of transaction statements:
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

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA