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

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;

相关推荐
美林数据Tempodata1 小时前
大模型驱动数据分析革新:美林数据智能问数解决方案破局传统 BI 痛点
数据库·人工智能·数据分析·大模型·智能问数
野槐2 小时前
node.js连接mysql写接口(一)
数据库·mysql
Zzzone6832 小时前
PostgreSQL日常维护
数据库·postgresql
chxii2 小时前
1.13使用 Node.js 操作 SQLite
数据库·sqlite·node.js
冰刀画的圈2 小时前
修改Oracle编码
数据库·oracle
这个胖子不太裤2 小时前
Django(自用)
数据库·django·sqlite
麻辣清汤2 小时前
MySQL 索引类型及其必要性与优点
数据库·mysql
2501_915374354 小时前
Neo4j 图数据库安装教程(2024最新版)—— Windows / Linux / macOS 全平台指南
数据库·windows·neo4j
it-搬运工4 小时前
3.图数据Neo4j - CQL的使用
数据库·neo4j
-借我杀死庸碌的情怀-5 小时前
navicat可视化页面直接修改数据库密码——mysql、postgresql、mangodb等
数据库·mysql·postgresql