exit when  mycursor%notFOUND;

解决方案 »

  1.   

    还是不行呀,还是sqlplus执行后,就一直处于死机状态.
      

  2.   

    loop里面不做fetch, not mycursor%FOUND永远也满足不了,当然无法退出循环
      

  3.   

    set serveroutput on
    declare 
    date1 varchar2(8);
    cursor mycursor is select xtrq from p9pip.yhdl;
    begin
    open mycursor;
    fetch mycursor into date1;
    loop
    exit when not mycursor%FOUND;
    if date1= '20040321' then
    dbms_output.put_line('success!');
    end if;
    fetch mycursor into date1;///////////////
    end loop;
    close mycursor;
    end;