Skip Headers

PL/SQL User's Guide and Reference
10g Release 1 (10.1)

Part Number B10807-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

COMMIT Statement

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

Description of commit_statement.gif follows
Description of the illustration commit_statement.gif

Keyword and Parameter Description


COMMENT

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.


WORK

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:

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

ROLLBACK Statement, SAVEPOINT Statement