declare 
cursor c is select col from table;
ls_part varchar2(100);
begin
open c;
loop
fetch c into ls_part;
exit when c%notfound;
end loop ;
close c;
end ;
/

解决方案 »

  1.   

    when you first fetch value
      

  2.   

    FETCH FIRST就是让游标指针重新指向第一行。declare cursor c is select col from table ;
    ls_part varchar2(100);
    begin
    open c ;
    loop
    fetch c into ls_part;
    exit when c%notfound
    end loop ;
    fetch first into ls_part 
    close c;
    end ;
      

  3.   

    楼上的语句可以吗?
    我想大不了关闭游标,再重新打开就是了!
    declare cursor c is select col from table ;
    ls_part varchar2(100);
    begin
    open c ;
    loop
    fetch c into ls_part;
    exit when c%notfound
    end loop ;
    close c;
    open c ;
    loop
    fetch c into ls_part;
    exit when c%notfound
    end loop ;
    close c;
    end ;
      

  4.   

    游标不能循环,关闲游标重新fetch c into ls_part;