Commit Statement (2024)

Share this page

Commit Statement

This statement commits the current database transaction.

This statement has the following syntax:

commit [work];

Note:The optional work keyword is used only for compatibility with some versions of SQL.

The commit statement terminates the current database transaction and commits any changes made by the transaction. After you issue a commit statement, you cannot undo (roll back) any changes to the database made by the committed transaction. A commit statement also closes any open cursors.

If the application terminates while a transaction is open, the database issues an implicit commit before terminating the application.

It is not necessary to issue explicit commit statements if you are running the application with autocommit on. When autocommit is on, the database automatically commits each database statement when it completes successfully. The default for autocommit is off.

For more information about autocommit and transaction management, see the Programming Guide.

If the commit statement is successful, it sets the system variable IIerrornumber to zero. Otherwise, it sets IIerrornumber to the appropriate error number. In both cases, IIrowcount is set to -1. For more information about these system variables, see the Programming Guide.

The system class, DBSessionObject, when used with the CommitWork method is equivalent to this statement. For more information about this system class and method, see DBSessionObject Class.

Examples--Commit Statement

Commit a database statement:

insert into employees(salary, age)

values(:salfield, :agefield);

commit work;

The following event block gives the user a choice to commit or roll back changes before the frame closes:

on terminate =
begin

if CurFrame.ConfirmPopup(messagetext =

'Commit database changes?') = PU_OK then

commit work;

else

rollback work;

endif;

end

Commit Statement (2024)
Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6067

Rating: 4.2 / 5 (43 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.