select D into C from qyjbxx where A=B; 当在没有满足A=B时 oracle报错 (1403 未找到任何数据)
D 为 number类型
我现在想找到不数据能不能不让它报错,提示条消息就行了。我百度了下好像oracle中也有类似java的异常捕获,
select D into C from qyjbxx where A=B;
exception
when no_data_found then
Err.oi_errcode := -1;
Err.oc_errtext := 'XXXX';
return;
不能通过编译 好像 select语句下不能接exception
哪位高手有什么好的方法!谢谢了
D 为 number类型
我现在想找到不数据能不能不让它报错,提示条消息就行了。我百度了下好像oracle中也有类似java的异常捕获,
select D into C from qyjbxx where A=B;
exception
when no_data_found then
Err.oi_errcode := -1;
Err.oc_errtext := 'XXXX';
return;
不能通过编译 好像 select语句下不能接exception
哪位高手有什么好的方法!谢谢了
beginselect D into C from qyjbxx where A=B;
exception
when no_data_found then
Err.oi_errcode := -1;
Err.oc_errtext := 'XXXX';
return;
end;
declare
v_err_code number;
v_err_msg varchar2(200);
begin
select D into C from qyjbxx where A=B;
exception
when no_data_found then
v_err_code:=sqlcode;
v_err_msg:=substr(sqlerrm,1,200);
dbms_output.putline('error code:'||v_err_code);
dbms_output.putline('error message:'||v_err_msg);
exception
end;
这就是一个块。
没什么可解释的。