Show TOC

Background documentationUNLOCK Statement (unlock_statement) Locate this document in the navigation structure

 

The UNLOCK (unlock_statement) releases locks on rows.

Structure

Syntax Syntax

  1. <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>
End of the code.
Explanation

Using the UNLOCK statement, shared 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 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 results table must have been specified with FOR UPDATE.

More Information

LOCK Statement (lock_statement)

Concepts of the Database System, Locks