本文主要是介绍存储过程中双循环迭代数据,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
create or replace procedure pro_zszg_report6 is
--让游标变量c_emps指向一个动态select查询的结果集
cursor c_report is select * from hbrmw6.rms_zszg_report ;
--5G基站数
cursor c_report6 is select re.city_id,re.county_id,ce.related_wg,wg.zh_label,count(*) nums from hbrmw6.RMS_G_NODEB re,hbrmw6.rms_equiproom rm,hbrmw6.RMS_NR_CELL ce,hbrmw6.rms_market_wangge wg where re.related_room=rm.int_id and ce.related_room=rm.int_id and ce.related_wg=wg.resno and re.stateflag='0' and re.status='现网' group by re.city_id,re.county_id,ce.related_wg,wg.zh_label;
begin
--循环开始
for e in c_report loop
for e6 in c_report6 loop
if (e.city_id =e6.city_id) and (e.county_id=e6.county_id) and (e.wangge=e6.zh_label) then
update hbrmw6.rms_zszg_report rt set rt.G5g_Site_Num=e6.nums where rt.city_id=e6.city_id and rt.county_id=e6.county_id and rt.wangge=e6.zh_label;
commit;
end if;
--循环2结束
end loop;
--循环1结束
end loop;
end pro_zszg_report6;
这篇关于存储过程中双循环迭代数据的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!