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

Specifies where to continue execution after a transaction.
Synopsis
END [TRANSACTION | WORK]
Description
The END TRANSACTION statement specifies the end of a transaction. This is where to continue program execution following a COMMIT statement or a ROLLBACK statement.
If an END TRANSACTION is encountered before either a COMMIT or a ROLLBACK, the current transaction is rolled back.
The TRANSACTION or WORK keywords are optional and provides no functionality. They are provided solely for compatibility with other MultiValue vendor products.
Note:
Caché MVBasic supports two sets of transaction statements:
These two sets of transaction statements should not be combined.
Example
The following example performs database operations within a transaction. It sets a variable x, which determines whether the transaction should be committed or rolled back.
PRINT "Before the transaction"
BEGIN TRANSACTION
 .
 .
 .
IF x=0 
  THEN COMMIT
  END
  ELSE ROLLBACK
  PRINT "Transaction rolled back"
  END
PRINT "This should not print"
END TRANSACTION
PRINT "After the transaction"
See Also