|
发表于 2020-7-30 18:15:01
|
显示全部楼层
很容易实现,代码见下面:
create or replace trigger tri_io_works
after update or insert on io_works_son
declare
cursor c is select wid,sum_isok from
(select wid,sum(nvl(isok,0))/count(nvl(isok,0)) as sum_isok from io_works_son group by wid)
where sum_isok =1;
v_wid io_works_son.wid%TYPE;
v_isok io_works_son.isok%TYPE;
begin
open c;
loop
fetch c into v_wid,v_isok;
exit when c%notfound;
update io_works set isfinish =1 where wid = v_wid;
end loop;
end; |
|