Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home
Jazz home  >  Papers & Training

IMAGE/SQL: Issues and answers concerning SQL tables

» 

Jazz home

»

Software

»

Papers & Training

»

Java

»

HP Partners

»

News & Events

»

Register for more info

Content starts here
Prev Page Next Page Manual Top Home Page


5.8 How do I terminate a transaction?



Key points


  • Transactions are ended with either a COMMIT WORK or a ROLLBACK WORK statement. All locks are released when a transaction is ended.

    • COMMIT WORK makes all data modifications made by the transaction permanent.
    • ROLLBACK WORK undoes all operations since the BEGIN WORK statement was issued. The ROLLBACK WORK statement can be useful under the following situations:

      • The SQLCA.SQLCODE indicates an error has occurred. (SQLCA is a special record variable that is updated by ALLBASE/SQL during every SQL call. It can be used to programmatically detect whether or not a call executes successfully.)

      • UPDATE, INSERT, or DELETE statements are issued on multiple rows. It is possible that one of the commands might fail after only some of the target rows had been operated on, and you want to undo the changes that were made (restore your data back to a consistent state).

      • You provide input indicating that you do not wish to commit the transaction.

  • Only the transaction of the user that issues the COMMIT WORK or the ROLLBACK WORK is affected by the statement.

  • Transactions can also be rolled back by ALLBASE/SQL without the user explicitly issuing the ROLLBACK WORK statement:

  • If you RELEASE from a DBEnvironment without issuing a COMMIT WORK, ALLBASE/SQL automatically rolls back the transaction.

  • If you have an active transaction in ISQL when you issue an EXIT command, you will be prompted about whether or not you want to commit the transaction. ISQL is being friendly by remembering that a transaction is in progress and asking you how to terminate it before it implicity issues a RELEASE statement. But if you issue a RELEASE statement explicity in ISQL while you have an active transaction, you will receive a message indicating that your transaction was aborted.

  • When a soft-crash or a hard-crash occurs, ALLBASE/SQL automatically rolls back all transactions that were active at the time of the crash.

  • When a deadlock occurs, ALLBASE/SQL automatically rolls back one of the transactions involved in the deadlock.


Prev Page Next Page Manual Top Home Page

Page last updated on November 29, 1995

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2004 Hewlett-Packard Development Company, L.P.