存储过程中双循环迭代数据

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;

相关推荐
pixcarp3 小时前
知识库系统的内容资产闭环怎么设计
服务器·数据库·后端·golang
JosieBook4 小时前
【数据库】时序预测能力的分级进化:TimechoAI如何让每一类用户都能精准预见未来
java·开发语言·数据库
吴声子夜歌6 小时前
SQL经典实例——使用多张表
数据库·sql
倔强的石头_7 小时前
《Kingbase护城河》——深度解密数据库行锁冲突与等待事件架构
数据库
IT策士7 小时前
Redis 从入门到精通:性能调优与多语言客户端对比
数据库·redis·缓存
Bert.Cai8 小时前
Oracle INSTR函数详解
数据库·oracle
茉莉玫瑰花茶9 小时前
综合案例 - AI 智能租房助手 [ 5 ]
服务器·数据库·人工智能·python·ai
ywl47081208710 小时前
jwt生产token,简单版helloworld
java·数据库·spring
器灵科技10 小时前
AI视频工具实测:Seedance/可灵/HappyHorse谁最能打?
java·运维·数据库·人工智能·github
huangdong_10 小时前
京东商品图片视频批量下载与m3u8视频合并技术完整实现方案
大数据·前端·数据库