而解决的方法就是直接用ROWID替代WHERE CURRENT OF [I]YOUR_CURSOR_NAME[/I][/COLOR]语句。
例子如下,
[php]
declare
-- query emp.name
cursor cur_emp
is
select a.deptno,
a.dname,
a.rowid,
b.rowid rowid_1
from dept a, emp b
where empno = 7369
and a.deptno = b.deptno
for update nowait;
4>。若3>不被有效处理,死锁就成形。
例如:执行以下程序于两个session上,第二个session会一直处于等待。。。直至
第一个session执行COMMIT 或ROLLBACK为止。
[php]
declare
-- query emp.name
cursor cur_emp
is
select empno, ename, job
from emp
where empno = 7369
for update of ename;
begin
for return_cur in cur_emp
loop
update emp
set ename = 'LHG'
where current of cur_emp;
end loop;
end;
[/php]
5>。防止4>的方法之一是加NOWAIT在FOR UPDATE之后。如此,第二个session不会一
直等下去,而是出现ORA-00054 [resource busy and acquire with NOWAIT specified]的
讯息。