COMMIT Statement

Makes changes that have been performed since the start of a transaction a permanent part of the database.

Category: Data Control
Restriction: The COMMIT statement has an effect only when autocommit functionality is off.
Supports: EXECUTE Statement
Data source: SASHDAT, Greenplum, MDS, MySQL, ODBC, Oracle, SAP HANA, Sybase IQ, Teradata

Syntax

COMMIT [TRANSACTION];

Details

When your program has completed all of the statements in the transaction, you must explicitly terminate the transaction using COMMIT or ROLLBACK. You use a COMMIT statement to make the changes to the database permanent.
You cannot roll back the changes to the database after the COMMIT statement is executed.
Note: The COMMIT statement has an effect only when autocommit functionality is off. In most data sources, autocommit functionality is on by default. Refer to the server administration documentation for information about how to turn off autocommit functionality. For example, see the SAS Federation Server: Administrator’s Guide for the appropriate connection option to the FedSQL driver. For the FEDSQL procedure, see the Base SAS Procedures Guide.
Note: For the SASHDAT data source, the COMMIT statement does not permanently alter the database. Instead, it closes the SASHDAT table, either when a statement is unprepared or when the connection is disconnected (default), depending on the setting of the COMMIT= connection option. If a SASHDAT table remains open when autocommit functionality is on, COMMIT can be used to close it.

Comparisons

The ROLLBACK statement causes all the uncommitted changes that were made by the transaction to be rolled back to the start of the transaction or to the point that is marked by the BEGIN statement. The COMMIT statement takes all the data changes that have been performed since the start of the transaction and makes them a permanent part of the database.

See Also