COMMIT (SQL)

#### Search Results

Search

# COMMIT (SQL)

`COMMIT`

This document covers the following topics:

- COMMIT Usage

- Consideration for Non-Natural-Programs

- COMMIT Example

Belongs to Function Group: Database Access and Update

See also COMMIT - SQL in the Natural for Db2 part of the Database Management System Interfaces documentation:

## COMMIT Usage

The SQL `COMMIT` statement corresponds to the `END TRANSACTION` statement. It indicates the end of a logical transaction and releases all data locked during the transaction. All data modifications are committed and made permanent.

Important
As all cursors are closed when a logical unit of work ends, a `COMMIT` statement must not be placed within a database modification loop; instead, it has to be placed outside such a loop or after the outermost loop of nested loops.

## Consideration for Non-Natural-Programs

If an external program written in another standard programming language is called from a Natural program, this external program should not contain its own `COMMIT` statement if the Natural program issues database calls, too. The calling Natural program should issue the `COMMIT` statement on behalf of the external program.

## COMMIT Example

    ...
    DELETE FROM SQL-PERSONNEL WHERE NAME = 'SMITH'
    COMMIT
    ...

### On this page

- COMMIT Usage
- Consideration for Non-Natural-Programs
- COMMIT Example