欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

游标的使用

程序员文章站 2022-05-16 09:23:29
...

定义游标: cursor calenderStatus_cur is select * from ut_calenderStatus ; vr_calenderStatus ut_calenderStatus % rowtype; 打开游标,提取游标中的数据到游标行中: open calenderStatus_cur; loop fetch calenderStatus_cur into vr_calenderStatus;

定义游标:

    cursor calenderStatus_cur 
    is
    select * from ut_calenderStatus ;
    vr_calenderStatus      ut_calenderStatus % rowtype;


打开游标,提取游标中的数据到游标行中:

    open calenderStatus_cur;
        loop
          fetch calenderStatus_cur into vr_calenderStatus;
          exit when calenderStatus_cur % notfound;
          up_日历_产品开放期设置(pi_serviceid,pi_opid,vr_calenderStatus.Calenderstatus,vr_calenderStatus.Fundcode,'0',pi_rq,pi_begin,pi_end,
                                       vr_calenderStatus.m,vr_calenderStatus.n,vr_calenderStatus.Prolong,po_returnmsg ,po_returncode); 
          if po_returncode  '0000' then
           rollback;
           return;
          end if;          
        end loop;
    close calenderStatus_cur;