open test('lile');
fetch test into myqty;if test%notfound then
     myqty:=0;
end if;

解决方案 »

  1.   

    open test('lile');
         if test%notfound then
            myqty:=0;
         else 
            fetch test into myqty;
        end if;
    应该改为
         open test('lile');
         fetch test into myqty;
         if test%notfound then
            myqty:=0;
         end if;
      

  2.   

    select sum(qty) from emp where name=xx and month='200101'
    的结果不会为空的
      

  3.   

    谢谢了,我解决了,总结两点;
    1.fetch 在前面,再判断notfound;
    2. 每次执行完毕,一定要关闭cursor,
    给分了,
    hushuangyang(hushuangyang) 10
    bzszp(SongZip) 10Lastdrop(空杯) 10