oracle 存储过程 实例 循环 给查询赋值 游标取值

CREATE OR REPLACE PROCEDURE p_updete_gs is     --仅供参考
  i_jdid varchar(32);
  i_ryid varchar(32);

  cursor cur is --游标  给查询赋值
  select c.jdid jdid, t.ryid rybh from t_zcj_rctj t,t_zj_jd c where
  t.ryid=c.rybh and t.bgzt<>'3' and c.bgzt<>'3'and c.zjjd<>3 
  and c.sfsp='3' and sysdate-sspsj2>='5';
BEGIN
    for x in cur loop--游标取值 循环
      i_jdid :=x.jdid;
      i_ryid:=x.rybh;
    --自己的语句
      update xxx set xx='3' where  x=i_jdid;
      update xxxx set xxxxx='3' where xx=i_ryid;
    end loop;

--这可以给记录表插数据
end ;

 

如果你觉得这篇内容对你挺有启发,我想邀请你帮我三个忙,让更多的人看到这篇文章:
1、点赞,可以让更多的人看到这篇文章
2、关注我的微信公众号,第一时间阅读我的文章。

3、也欢迎关注我的博客哦

posted @ 2022-07-16 13:52  深山藏古客  阅读(34)  评论(0编辑  收藏  举报