create or replace procedure PRC_analysis_alert is
---获得“预警研判分析-预警信息统计”结果 的游标
cursor CRS_AlERT is
select xzqh, zzjgdm , yjlx ,substr(TJRQ,1,6) tjyf ,clzt ,sum(yjsl) yjsl
from t_pvbdp_statistics_alert group by xzqh, zzjgdm , yjlx ,substr(TJRQ,1,6) ,clzt ;
begin
----预警研判分析 - 预警信息统计
execute immediate 'truncate table t_pvbdp_analysis_alert' ;
for alert_msg in CRS_AlERT loop
begin
insert into t_pvbdp_analysis_alert
(id, tjyf,xzqh, zzjgdm, yjlx, clzt, yjsl)
values
(sys_guid() ,
alert_msg.tjyf,
alert_msg.xzqh,
alert_msg.zzjgdm,
alert_msg.yjlx,
alert_msg.clzt,
alert_msg.yjsl);
end;
end loop;
end PRC_analysis_alert;
oracle 存储过程(其中使用了游标)例子
最新推荐文章于 2024-05-09 10:41:33 发布