![]() |
SQL-J Language Reference
|
Reference Manual |
LOCK TABLE statementAllows a user to explicitly acquire a shared or exclusive table lock on the specified table. The table lock lasts until the end of the current transaction. Explicitly locking a table is useful for:
You cannot lock system tables with this statement. SyntaxLOCK TABLE TableName IN { SHARE | EXCLUSIVE } MODE Once a table is locked in either mode, a transaction does not acquire any subsequent row-level locks on a table. For example, if a transaction locks the entire Hotels table in share mode in order to read data, a particular statement may need to lock a particular row in exclusive mode in order to update the row. However, the previous table-level lock on Hotels forces the exclusive lock to be table-level as well. If the specified lock cannot be acquired because another connection already holds a lock on the table, a statement-level exception is raised (SQLState X0X02) after the deadlock timeout period. LOCK TABLE Examples
-- lock the entire table in share mode to avoid
-- lock the entire table in exclusive mode
UPDATE HotelAvailability
UPDATE HotelAvailability
UPDATE HotelAvailability
-- if a transaction needs to look at a table before |
|
![]() Cloudscape Version 3.6 For information about Cloudscape technical support, go to: www.cloudscape.com/support/.Copyright © 1998, 1999, 2000 Informix Software, Inc. All rights reserved. |