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;