PL/SQL User's Guide and Reference 10g Release 1 (10.1) Part Number B10807-01 |
|
|
View PDF |
The COMMIT
statement makes permanent any changes made to the database during the current transaction. A commit also makes the changes visible to other users. For more information, see "Overview of Transaction Processing in PL/SQL".
Syntax
Keyword and Parameter Description
Specifies a comment to be associated with the current transaction. Typically used with distributed transactions. The text must be a quoted literal no more than 50 characters long.
Optional, for readability only.
Usage Notes
The COMMIT
statement releases all row and table locks, and erases any savepoints you marked since the last commit or rollback. Until your changes are committed:
You can see the changes when you query the tables you modified, but other users cannot see the changes.
If you change your mind or need to correct a mistake, you can use the ROLLBACK
statement to roll back (undo) the changes.
If you commit while a FOR
UPDATE
cursor is open, a subsequent fetch on that cursor raises an exception. The cursor remains open, so you should still close it. For more information, see "Using FOR UPDATE".
When a distributed transaction fails, the text specified by COMMENT
helps you diagnose the problem. If a distributed transaction is ever in doubt, Oracle stores the text in the data dictionary along with the transaction ID. For more information about distributed transactions, see Oracle Database Concepts.
In SQL, the FORCE
clause manually commits an in-doubt distributed transaction. PL/SQL does not support this clause:
COMMIT WORK FORCE '23.51.54'; -- not allowed
In embedded SQL, the RELEASE
option frees all ocks and cursors held by a program and disconnects from the database. PL/SQL does not support this option:
COMMIT WORK RELEASE; -- not allowed
Related Topics