| United States-English |
|
|
|
![]() |
ALLBASE/ISQL Reference Manual: HP 9000 Computer Systems > Chapter 2 Getting Started with ISQLManaging Transactions |
|
A transaction consists of one or more SQL statements that are grouped together to form a unit of work. For example, if you wanted to transfer money from a savings to a checking account, the withdrawal and the deposit would both occur within the same transaction. A transaction begins with a BEGIN WORK statement and ends with either a COMMIT WORK or a ROLLBACK WORK statement. Either all the statements or none of the statements are executed. ISQL automatically processes a BEGIN WORK statement whenever you successfully submit most SQL statements and a transaction is not already in progress:
In this example, the UPDATE STATISTICS statement automatically does an implicit BEGIN WORK. Thus the explicit BEGIN WORK creates an error condition. The following SQL statements do not cause ISQL to process a BEGIN WORK statement:
ISQL also automatically processes a BEGIN WORK statement whenever you successfully submit the following ISQL commands and a transaction is not already in progress:
Within a transaction, you can set savepoints. Work accomplished after a savepoint can be undone at any time prior to the end of the transaction. When you issue the SAVEPOINT statement in ISQL, you are assigned a savepoint number, starting at 1 with each new transaction. You reference the savepoint number in a ROLLBACK WORK statement to undo work done since the referenced savepoint was established. For example:
ISQL automatically terminates transactions for you in several instances:
When accessing multiuser DBEnvironments from ISQL, you may need to submit the COMMIT WORK or ROLLBACK WORK statement frequently to improve concurrency. More information on managing SQL transactions is provided in the ALLBASE/SQL Database Administration Guide. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||