602SQL Documentation Index  

_IV_LOCKS System Query

The system query _iv_locks returns a list of locks that are currently active on table records or object definitions (system table records). Memory page locks are also returned (e.g. indexes). Each lock has a separate record in the result.

The result may be very complex and may slow server performance when updating data. The same applies for viewing locks using the Monitor window (Locks tab).

These columns are present in the result:

Column name Type Contents
Schema_name CHAR(31) Name of the schema the locked table belongs, NULL for system tables (usually OBJTAB and TABTAB)
Table_name CHAR(31) Name of the table whose records are locked, NULL for memory page locks
Record_number INT Number of records (absolute) that are locked. If all records are locked (e.g. the entire table is locked) the value here is -1. If the table name is empty and this number is not empty, this lock is a memory page lock and the number specified here is the memory page number (for internal use only).
Lock_type INT Lock type: read lock = 128, write lock = 64, temporary write lock = 32, temporary read lock = 16
Owner_usernum INT The number of the user (returned by the Client_number function) that placed the lock
Owner_name CHAR(31) Name of the owner
Object_name CHAR(31) If an object definition lock is on the system table TABTAB or OBJTAB, this is the name of the application object (e.g. the object being edited)

Example

This query only returns locks on records (not on system tables).

SELECT table_name, record_number, owner_name
FROM _iv_locks
WHERE table_name NOT IN (NULL, 'tabtab', 'objtab')