COMMIT

Use the COMMIT command to commit the current transaction. All changes that are made by the transaction become visible to other users.

Syntax

Syntax for committing a transaction:
COMMIT [ WORK | TRANSACTION ];

Inputs

The command takes the following inputs:
Table 1. COMMIT inputs
Input Description
WORK These keywords are optional keywords that have no effect.
TRANSACTION

Outputs

The command has the following outputs:

Table 2. COMMIT outputs
Output Description
COMMIT The commit action was successful.
NOTICE: COMMIT: no transaction in progress There was no transaction in progress. Always precede a COMMIT command with a BEGIN command.

Privileges

You do not need any special privileges to issue the COMMIT command.

Usage

The following provides sample usage.
  • Make all changes permanent:
       COMMIT WORK;
  • Use the COMMIT command within (at the end of) a transaction:
    MYDB.SCH1(USER)=> begin;
       BEGIN
    MYDB.SCH1(USER)=> insert into cities values ('Boston', 
    'Massachusetts');
       INSERT 0 1
    MYDB.SCH1(USER)=> insert into cities values ('Houston', 'Texas');
       INSERT 0 1
    MYDB.SCH1(USER)=> commit;
       COMMIT
    MYDB.SCH1(USER)=>