如果是 no_data_found begin select dc_id into maindcid from main_information where ain_information.dc_id=dcid; exception when NO_DATA_FOUND then ...... end;
select count(*),max(dc_id) into l_count, maindcid from main_information where ain_information.dc_id=dcid;if l_count > 0 then
else -- 返回为空的处理 end if;这样就不必进入异常处理,而是可以继续了。
declare maindcid main_information.dc_id%type; begin select dc_id into maindcid from main_information where ain_information.dc_id=dcid; exception when no_data_found then --anything; end; /
我的方法试了吗?l_count是需要声明的一个变量l_count number;
就是说,在存储过程中能不能用 exception when no_data_found then --anything; end;这种异常判定方式
谢谢~~
if maindcid is null then
但没找到就不行了
用异常处理判断
begin
select dc_id into maindcid from main_information where ain_information.dc_id=dcid;
exception
when NO_DATA_FOUND then
......
end;
else -- 返回为空的处理
end if;这样就不必进入异常处理,而是可以继续了。
maindcid main_information.dc_id%type;
begin
select dc_id into maindcid from main_information where ain_information.dc_id=dcid;
exception
when no_data_found then
--anything;
end;
/
exception
when no_data_found then
--anything;
end;这种异常判定方式