## UNLOCK Statement (unlock_statement)

The UNLOCK statement (unlock_statement) releases locks on rows.

### Syntax

<unlock_statement> ::= UNLOCK <row_spec>... IN SHARE MODE
| UNLOCK <row_spec> ... IN EXCLUSIVE MODE
| UNLOCK <row_spec> ... IN SHARE MODE <row_spec> ... IN EXCLUSIVE MODE
| UNLOCK <row_spec> ... OPTIMISTIC

<row_spec> ::= ROW <table_name> KEY <key_spec>,...
| ROW <table_name> CURRENT OF <result_table_name>

### Explanation

Using the UNLOCK statement, share locks, optimistic locks and exclusive locks can be released within a transaction for single table rows that have not yet been changed.

If a row has not been inserted, changed, or deleted, its exclusive lock cannot be released using the UNLOCK statement.

The unlock statement does not fail if the specified lock does not exist or cannot be released.

For tables defined without key columns, the implicit key column SYSKEY CHAR(8) BYTE can be used in a key specification key_spec .

If CURRENT OF <result_table_name> is specified, the result table must have been specified with FOR UPDATE.

See also:

LOCK Statement (lock_statement)

Concepts of the Database System, Locks for Database Objects