LOCK TABLE

Controls access to a table by other users.

SYNTAX

table_name Name of the table you want to change the lock settings for.

DESCRIPTION

The LOCK TABLE command allows you to control access to a table by other users. To execute this command you must be the table owner, have DBA or SYSADM security privileges, have SELECT privileges (to lock the table in SHARE mode), or have UPDATE or DELETE privileges (to lock the table in EXCLUSIVE mode).

This command lets you lock a table in a SHARE or EXCLUSIVE mode to control access to a table by other users. SHARE mode allows other users read access to the table but denies write access; other users cannot insert, update, or delete rows if the table is locked in SHARE mode. EXCLUSIVE mode denies other users both read and write access; other users cannot select, insert, update, or delete rows if the table is locked in EXCLUSIVE mode.

You can also use this command to reduce the number of locks acquired in a database operation. If the default lock level of a table is page or row, you can use this command to get a table level lock in order to avoid to get many lower level locks. In general there is no need to do this since DBMaker will automatically upgrade the lock level on a table if too many locks are acquired.

The WAIT/NO WAIT keywords are optional. These keywords specify whether DBMaker should wait to acquire a lock if the lock is not available immediately. If you specify the NO WAIT option, DBMaker will not wait to acquire a lock and will return an error message stating the lock could not be acquired. The amount of time DBMaker will wait is determined by the DB_LTIMO keyword in the dmconfig.ini configuration file. The default value is WAIT.

EXAMPLE

The following example locks the Employees table in SHARE mode with the WAIT option.

LOCK TABLE Employees IN SHARE MODE WAIT

The following example locks the Employees table in EXCLUSIVE mode with the NO WAIT option.

LOCK TABLE Employees IN EXCLUSIVE MODE  NO WAIT

RELATED FUNCTIONS

< LOAD STATISTICS | Contents | REBUILD TEXT INDEX >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.