PURPOSE: This statement signals the successful end-of-transaction. A transaction is a group of SQL statements whose changes are logically connected and can be made permanent or undone as a unit. All updates made during this transaction are made permanent, all row locks are released, and active SQL SELECT statements are closed.
When you update the Oracle Server in some way, that update should initially be regarded as tentative only - tentative in the sense that, if something subsequently goes wrong, the update may be undone. Updates remain tentative until an SQL COMMIT or SQL ROLLBACK statement is executed. The SQL COMMIT statement makes all tentative updates firm or committed. Once committed, an update is guaranteed never to be undone.
A transaction begins with the first executable SQL statement after a COMMIT, ROLLBACK, or connection to the database.
SQL COMMIT WORK
SQL SELECT * FROM BOOKS_ORA WHERE "BOOKS_ORA.TYPE_CODE = 'for_lang'"
START:10
SQL FETCH NEXT ROW
LEAVE:10 IF @SQLCODE # 0
SQL UPDATE BOOKS_ORA SET "BOOKS_ORA.PUB_CODE = '0736'" CURRENT ROW
REPEAT:10
FILL MENU_ASK_EM_IF_OK_ID:D
IF:10 @MENU_KEYWORD = 'YES'
SQL COMMIT WORK
ORIF:10 @MENU_KEYWORD = 'NO'
SQL ROLLBACK WORK
CONTINUE:10
NOTES: You cannot roll back a transaction after an SQL COMMIT WORK statement has been executed.
The SQL BEGIN WORK statement will work with Oracle only if the READ ONLY clause is included. The SQL BEGIN WORK statement is normally used to mark the beginning of a transaction, but is not needed with Oracle.
SEE ALSO: SQL ROLLBACK WORK statement