| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> How to avoid this conflict?
Assuming my record in mytable as:
id Ln# value status 1 1 A X 1 2 B X When one procedure is updating the status that uses a trigger: update mytable set status ='Y' where id = 1 and status ='X';
in the meantime, the other procedure is inserting a new record using Procedure A
i_id NUMBER;
i_ln# NUMBER;
CURSOR c_my IS
select MAX(id), MAX(Ln#)
from mytable
where status ='X';
BEGIN
open c_my;
fetch c_my into i_id, i_ln#;
IF c_my%FOUND THEN
insert into mytable
values (i_id, i_ln#+1, 'C', 'X');
ELSE
insert into mytable
values (i_id+1, 1, 'C', 'X');
END IF;
close c_my;
END;
C Chang Received on Sun Aug 11 2002 - 21:43:49 CDT
![]() |
![]() |