0
我是一个非数据库家伙..你可以请你分享你的意见,以改善下面的sp样本,如使用全局临时表或索引或可能会改善现有的查询。在原代码中,我会对不同的桌子有很多更新查询。谢谢!提高存储过程性能
CREATE OR REPLACE PROCEDURE SYSTEM.process_log1
IS
cursor cur_attuid_change is
select
sup.id as id,
sup.name as name,
sup.role as role,
sup.technology as technology
from main hr, secondary sup
where sup.id=hr.id;
BEGIN
-- update records in main tables from the cursor
for rec_attuid_change in cur_attuid_change loop
update main t1
set t1.id = rec_attuid_change.id,
t1.name = rec_attuid_change.name,
t1.ROLE=rec_attuid_change.role,
t1.technology=rec_attuid_change.technology
where t1.id = rec_attuid_change.id;
commit;
update main1 t1
set t1.id = rec_attuid_change.id,
t1.name = rec_attuid_change.name,
t1.ROLE=rec_attuid_change.role,
t1.technology=rec_attuid_change.technology
where t1.id = rec_attuid_change.id;
commit;
update main2 t1
set t1.id = rec_attuid_change.id,
t1.name = rec_attuid_change.name,
t1.ROLE=rec_attuid_change.role,
t1.technology=rec_attuid_change.technology
where t1.id = rec_attuid_change.id;
commit;
end loop;
END;
/