微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

oracle 存储过程其中使用了游标例子

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,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,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;

原文地址:https://www.jb51.cc/oracle/210959.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐