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 on PL/SQL transaction processing, see "Overview of Transaction Processing in PL/SQL".

The SQL COMMIT statement can be embedded as static SQL in PL/SQL. For syntax details on the SQL COMMIT statement, see the Oracle Database SQL Reference. See also "Committing Transactions" in Oracle Database Application Developer's Guide - Fundamentals and the COMMIT_WRITE initialization parameter in Oracle Database Reference.

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".


For examples, see the following:

Example 6-1, "Data Manipulation With PL/SQL"
Example 6-3, "Substituting PL/SQL Variables"
Example 6-36, "Using COMMIT With the WRITE Clause"
Example 6-40, "Using SET TRANSACTION to Begin a Read-only Transaction"
Example 6-43, "Declaring an Autonomous Function in a Package"

Related Topics

"ROLLBACK Statement"
"SAVEPOINT Statement"
"Transaction Control"
"Fetching Across Commits"