cursor 在某一操作之前打开 fetch cursorname into var1

工作中遇到这样一个问题,在一个存储过程中,我想让一个游标在某一操作之前打开,说白了操作会影响我游标中已定义好的数据,这里我们用到游标的第二种用法,代码如下

cursor c_relation is

      select f_id from ly_zg_bhrelationcheck d where d.file_id = varFILE_ID;
--申明
     

     open c_relation;
--打开

     loop

      fetch c_relation into varF_id;

      update ly_zg_bhrelationcheck d

         set d.file_id = varLogoutDocID

       where d.f_id = varF_id;

      exit when c_relation%notfound;

    end loop;
--循环操作数据

猜你喜欢

转载自www.cnblogs.com/wangjp-1233/p/10115480.html