Oracle 使用 SELECT...FOR UPDATE OF 锁定
我从表 FOO 和 BAR 中进行选择。我想锁定正在返回的 FOO 记录,但不希望锁定 BAR 记录。
cursor c_foobar is
select foo.*, bar.* from
foo, bar
where foo.id = bar.foo_id
for update of <what should I put here?>
似乎我需要指定各个列,但我希望锁定 foo 的整个记录。例如,我希望我可以做类似的事情:
cursor c_foobar is
select foo.*, bar.* from
foo, bar
where foo.id = bar.foo_id
for update of foo
我是否必须枚举 for update of
部分中 foo 的每一列才能锁定它们?或者我可以任意选择 foo 中的任何列,甚至那些不是其主键的列,并且它会锁定整个记录?
I'm selecting from tables FOO and BAR. I'd like to lock the records of FOO which are being returned, but I don't want the records of BAR to be locked.
cursor c_foobar is
select foo.*, bar.* from
foo, bar
where foo.id = bar.foo_id
for update of <what should I put here?>
It seems like I need to specify individual columns, but I want the entire record of foo to be locked. e.g. I wish I could do something like:
cursor c_foobar is
select foo.*, bar.* from
foo, bar
where foo.id = bar.foo_id
for update of foo
Do I have to enumerate every column of foo in the for update of
section in order to lock them all? Or can I arbitrarily choose any column in foo, even those which are not its primary key, and it will lock the entire record?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自10G PL/SQL 文档 :
From the 10G PL/SQL documentation: