把 sql%NOTFOUND 改为 o = '0' 就可以了.%NOTFOUND 是在游标的时候用到的.

解决方案 »

  1.   

    create or replace procedure pout(i number,o out varchar2) is
     begin
     select ename into o from my where empno=i;
     --if sql%notfound then
      --dbms_output.put_line('wrong');
     --else
      dbms_output.put_line(o);
     --end if;
    exception
        when no_data_found then
          dbms_output.put_line('wrong');
    end;
      

  2.   

    同意楼上的!
    一般在使用SQL%ROWCOUNT时主要用于判断update、delete等更新、删除了多少记录
    而在select时,由于选择不到数据,也就无法进行into了,从而产生异常,所以只能用exception来捕捉异常了。