Lock Table Statement; Syntax Description Of Lock Table; Considerations For Lock Table; Authorization Requirements - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

LOCK TABLE Statement

"Syntax Description of LOCK TABLE"

"Considerations for LOCK TABLE"

"Examples of LOCK TABLE"
The LOCK TABLE statement locks a table (or the underlying tables of a view) and its indexes,
limiting other access to the table and its indexes while your process executes DML statements.
See
"Database Integrity and Locking" (page
LOCK TABLE is a Neoview SQL extension.
LOCK TABLE table IN {SHARE | EXCLUSIVE} MODE
Syntax Description of LOCK TABLE
table
is the name of the table or view to be locked. See
IN {SHARE | EXCLUSIVE} MODE
specifies the locking mode:
SHARE
EXCLUSIVE
If you request a share lock on a table locked with an exclusive lock by another user, your
request waits until the exclusive lock is released.
If you request an exclusive lock on a table and any part of the table is locked by another user,
your request waits until the lock is released, or until your lock request times out and an error
message is returned.
Considerations for LOCK TABLE

Authorization Requirements

To lock a table, you must have authority to read the table. To lock a view, you must have authority
to read the view but not necessarily the tables underlying the view.

Modifying Default Locking

A SELECT statement automatically acquires share locks unless you specify EXCLUSIVE in the
IN clause of the SELECT statement. The DELETE, INSERT, and UPDATE statements automatically
acquire exclusive locks.
You can use LOCK TABLE with the EXCLUSIVE option to force the use of exclusive locks for a
subsequent SELECT; however, keep in mind that LOCK TABLE locks the entire table.

Effect of AUTOCOMMIT Option

At the start of a session, the AUTOCOMMIT option is ON by default. When this option is ON,
Neoview SQL automatically commits any changes, or rolls back any changes, made to the database
at the end of statement execution. When you issue a LOCK TABLE statement without turning
off AUTOCOMMIT, Neoview SQL locks the table temporarily, commits the transaction at the
end of the LOCK TABLE statement and releases the locks. If you use LOCK TABLE, turn off
AUTOCOMMIT by using the SET TRANSACTION statement. See
Statement" (page
166).
31).
"Database Object Names" (page
Other processes can read, but not delete, insert, or
update the table or view.
Other processes can read with READ UNCOMMITTED
access, but cannot read with READ COMMITTED or
SERIALIZABLE access, and cannot delete, insert, or
update the table or view.
196).
"SET TRANSACTION
LOCK TABLE Statement
127

Advertisement

Table of Contents
loading

Table of Contents