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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34775102/article/details/83109873

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 ;

猜你喜欢

转载自blog.csdn.net/qq_34775102/article/details/83109873