23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LOCK TABLE<br />

LOCK TABLE<br />

Syntax<br />

40<br />

Authorization<br />

Must have DBA privilege, ownership of the table, INSERT privilege on the table, or SELECT<br />

privilege on all the tables or views referred to in the query_expression, if a<br />

query_expression is specified.<br />

Related statements<br />

REVOKE<br />

Explicitly locks one or more specified tables for shared or exclusive access.<br />

LOCK TABLE table_name [ , table_name ] , ...<br />

IN { SHARE | EXCLUSIVE } MODE ;<br />

table_name<br />

The table in the database that you want to lock explicitly. You can specify one table or a<br />

comma-separated list of tables.<br />

SHARE MODE<br />

Allows all transactions to read the tables. Prohibits all other transactions from modifying<br />

the tables. After you acquire an explicit lock on a table in SHARE MODE, any SELECT<br />

statements in your transaction can read rows and do not implicitly acquire individual<br />

record locks. Any INSERT, UPDATE, and DELETE statements do acquire record locks.<br />

EXCLUSIVE MODE<br />

Allows the current transaction to read and modify the tables, and prohibits any other<br />

transactions from reading or modifying the tables. After you acquire an explicit lock on a<br />

table in EXCLUSIVE MODE, you can SELECT, INSERT, UPDATE, and DELETE rows, and your<br />

transaction does not implicitly acquire individual record locks for these operations.<br />

Examples Unless another transaction holds an EXCLUSIVE lock on the teratab and megatab tables, the<br />

SHARE MODE example explicitly locks the tables. The shared lock allows all transactions to read<br />

the tables. Only the current transaction can modify the tables, as shown in the following<br />

example:<br />

LOCK TABLE teratab, megatab IN SHARE MODE ;<br />

Unless another transaction holds a lock on the teratab table, the EXCLUSIVE MODE example<br />

locks the teratab table for exclusive use by the current transaction. No other transactions can<br />

read or modify the teratab table, as shown in the following example:<br />

LOCK TABLE teratab IN EXCLUSIVE MODE ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!