QUOTE:
最初由 wljcan 发布
以上过程如果使用错误捕获方式,如何知道是哪一句出错呢?
为每一段语句分别进行例外处理即可.
begin
select ...........
exception when no_data_found then
........
end;
begin
select ...........
exception when no_data_found then
........
end;
或者, 另一个方法, 设置一个变量, 执行到每个语句, 为该变量赋以不同的值, 在例外中判断.
begin
v_tmp := 1;
select ...........
v_tmp := 2;
select ...........
exception when no_data_found then
if v_tmp = 1 then
........
elsif v_tmp = 2 then
..........
else
..........
end if;
end;