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

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;

相关推荐
爬山算法1 小时前
Redis(127)Redis的内部数据结构是什么?
数据结构·数据库·redis
应用市场1 小时前
Qt QTreeView深度解析:从原理到实战应用
开发语言·数据库·qt
q***96581 小时前
Spring Data JDBC 详解
java·数据库·spring
Hello,C++!2 小时前
linux下libcurl的https简单例子
linux·数据库·https
合方圆~小文2 小时前
高性能20倍变焦球机转动功能监控设备
数据结构·数据库·数码相机·模块测试
q***58193 小时前
【SQL】MySQL中的字符串处理函数:concat 函数拼接字符串,COALESCE函数处理NULL字符串
数据库·sql·mysql
懒羊羊不懒@3 小时前
【MySQL | 基础】多表查询
数据库·sql·mysql
百***6973 小时前
redis 使用
数据库·redis·缓存
mit6.8243 小时前
[Column] 构建十亿/s级DB | 索引DB&RTDB | Kafka 为中心 | Rust 构建引擎
数据库
q***0564 小时前
在Mysql环境下对数据进行增删改查
数据库·mysql