现在有两个游标c1,c2,现在"执行语句"可能抛异常,这样游标c2就关不了了,我想最好能自定义个异常给这个"执行语句",这样就能定位到这个异常了
重点:
1.抛异常的话,游标也能关了
2.给"执行语句"自定义个异常,我能捕获它
程序是这样的:
begin
open c1;
loop
begin
feth c1 into rec1; --rec为记录类型
--打开c2
open c2;
loop
begin
feth c2 into rec2; --rec为记录类型
执行语句; -------------------------------此处抛异常
end;
end loop;
close c2;
commit;
excepiton
when others then
-- 异常处理
end;
end loop;
end;
close c1;
end;
重点:
1.抛异常的话,游标也能关了
2.给"执行语句"自定义个异常,我能捕获它
程序是这样的:
begin
open c1;
loop
begin
feth c1 into rec1; --rec为记录类型
--打开c2
open c2;
loop
begin
feth c2 into rec2; --rec为记录类型
执行语句; -------------------------------此处抛异常
end;
end loop;
close c2;
commit;
excepiton
when others then
-- 异常处理
end;
end loop;
end;
close c1;
end;
IF ( C1%ISOPEN = TRUE ) THEN
CLOSE C1;
END IF; IF ( C2%ISOPEN = TRUE ) THEN
CLOSE C2;
END IF;