请教各位一个问题?

[复制链接]
查看11 | 回复4 | 2008-11-14 14:42:19 | 显示全部楼层 |阅读模式
如何将一个表进行锁定?
回复

使用道具 举报

千问 | 2008-11-14 14:42:19 | 显示全部楼层
LOCK TABLE table_name in lockmode MODE [NOWAIT];
lockmode:
ROW SHARE allows concurrent access to the locked table, but prohibits users
from locking the entire table for exclusive access. ROW SHARE is synonymous
with SHARE UPDATE, which is included for compatibility with earlier versions
of Oracle.
ROW EXCLUSIVE is the same as ROW SHARE, but also prohibits locking in SHARE
mode. Row Exclusive locks are automatically obtained when updating,
inserting, or deleting.
SHARE UPDATE—see ROW SHARE.
SHARE allows concurrent queries but prohibits updates to the locked table.
SHARE ROW EXCLUSIVE is used to look at a whole table and to allow others to
look at rows in the table but to prohibit others from locking the table in SHARE
mode or updating rows.
EXCLUSIVE allows queries on the locked table but prohibits any other activity
on it.
NOWAIT
Specify NOWAIT if you want Oracle to return control to you immediately if the
specified table (or specified partition or subpartition) is already locked by another
user. In this case, Oracle returns a message indicating that the table, partition, or
subpartition is already locked by another user.
If you omit this clause, Oracle waits until the table is available, locks it, and returns
control to you.
回复

使用道具 举报

千问 | 2008-11-14 14:42:19 | 显示全部楼层
LOCK TABLE TABLE_NAME IN EXCLUSIVE MODE
.....
COMMIT
回复

使用道具 举报

千问 | 2008-11-14 14:42:19 | 显示全部楼层
哦,谢谢你们,我试试~
回复

使用道具 举报

千问 | 2008-11-14 14:42:19 | 显示全部楼层
不错,可以用~!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行