日期:2014-05-17  浏览次数:20878 次

关于空结果集的处理
在存储过程中,如何判断结果集为空?

我用nvl函数,发现这个只是在有结果,但是结果字段是空的情况下有效。

有没有简单的方法?

------解决方案--------------------
declare
i int;
begin
select count(*) into i from table;
--i=0 为空结果集
end;



------解决方案--------------------
begin
select a into b from c where rownum <2;
exception
when NO_DATA_FOUND then
ret:=1;
when others then
ret:=2;
end;

这样行吗??
我一直都是这样处理的