没有必要这么做, 完全可以不作这种操作.创建一个物化视图,更新机制为refresh on commit; 或者直接创建一个视图去做这种统计工作.
create or replace procedure aa(id in number,month number,year in number) as begin insert into table(..) values(..); commit; update table a set 年实际值=(select sum(月实际值) from table where b.year=year) where a.year=year; end aa;
或者直接创建一个视图去做这种统计工作.
as
begin
insert into table(..)
values(..);
commit;
update table a set 年实际值=(select sum(月实际值) from table where b.year=year)
where a.year=year;
end aa;