Indexes; Examples Of Lock Table - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

Indexes

LOCK TABLE attempts to lock all indexes of any table it locks. If an index is not available or if
the lock request times out, LOCK TABLE displays a warning and continues to request locks on
other indexes.

Examples of LOCK TABLE

Lock a table with an exclusive lock (at a time when few users need access to the database)
to perform a series of updates:
BEGIN WORK;
LOCK TABLE persnl.employee
IN EXCLUSIVE MODE;
UPDATE persnl.employee
SET salary = salary * 1.05
WHERE jobcode <> 100;
COMMIT WORK;
COMMIT WORK automatically unlocks the table when it ends the transaction.
Delete all rows of the JOB table that have a job code that is not assigned to any employee:
BEGIN WORK;
--- SQL operation complete.
LOCK TABLE persnl.job
IN EXCLUSIVE MODE;
--- SQL operation complete.
LOCK TABLE persnl.employee
IN SHARE MODE;
--- SQL operation complete.
DELETE FROM persnl.job
WHERE jobcode NOT IN
(SELECT DISTINCT jobcode
FROM persnl.employee);
--- 1 row(s) deleted.
COMMIT WORK;
--- SQL operation complete.
UNLOCK TABLE persnl.job;
--- SQL operation complete.
128
SQL Statements

Advertisement

Table of Contents
loading

Table of Contents