参考:https://www.cnblogs.com/fuchangmeng/p/5593537.html
declare
a varchar2(255) := 30 ;
cus_exp EXCEPTION; --自定义异常
begin
begin
dbms_output.put_line('30进来');
if (a = 30) then --异常判断
RAISE cus_exp; --抛异常
end if;
dbms_output.put_line('30出来');
exception
when cus_exp then
dbms_output.put_line('30自定义异常!');
when OTHERS then
dbms_output.put_line('others error');
end;
dbms_output.put_line('30-->40');
begin
dbms_output.put_line('40进来');
if (a = 40) then
RAISE cus_exp;
end if;
dbms_output.put_line('40出来');
exception
when cus_exp then
dbms_output.put_line('40自定义异常!');
when OTHERS then
dbms_output.put_line('others error');
end;
dbms_output.put_line('过程出来');
end;
continue与 exit只能用于循环;
使用RETURN的时候,直接跳出存储过程或者函数;
则抛出异常,会结束一个 begin-end 语句模块的运行;不会影响后面的模块运行
以上测试所得。