使用SELECT ...进行更新的Oracle锁定 [英] Oracle locking with SELECT...FOR UPDATE OF
本文介绍了使用SELECT ...进行更新的Oracle锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从表FOO和BAR中进行选择.我想锁定返回的FOO记录,但是我不想锁定BAR的记录.
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?>
似乎我需要指定单个列,但是我想锁定foo的整个记录.例如我希望我可以做类似的事情:
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
我是否必须枚举for update of
部分中foo的每一列才能将其全部锁定?还是我可以随意选择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?
推荐答案
查看全文