oracle fetch 游标

open c_job;
         loop
fetch c_job into c_row;
 exit when c_job%notfound;
            dbms_output.put_line(c_row.empno||'-'||c_row.ename||'-'||c_row.job||'-'||c_row.sal);
         end loop;
 close c_job;

--=================================================================

   p_start:=0;
    p_pkdq:=0;
 
    p_length:=length(p_pinkunxian);
    p_number:=(p_length+1)/3; --贫困线数量
    WHILE(p_start <p_number)
    LOOP
   
          p_xqdm:=substr(p_pinkunxian,p_start*3+1,2); --得到县区代码
          select count(distinct bmxh) into p_count from ks where ks.dx=p_xqdm and zt>4;
          p_pkdq:=p_pkdq+p_count;
         p_start:=p_start+1;
     
    END LOOP;

posted @ 2014-03-16 09:09  -琥珀川-  阅读(1676)  评论(0编辑  收藏  举报