1.弹出错误框:
示例代码:
declare v_count number;begin select count(*) into v_count from dept; if v_count < 10 then raise_application_error(-20001,'数量小于10'); end if;end;
执行结果:
2.控制台显示:
示例代码:
declare v_count number;my_exp exception;begin select count(*) into v_count from dept; if v_count < 10 then raise my_exp; end if; exception when my_exp then dbms_output.put_line('数量小于10'); when others then dbms_output.put_line('其他异常');end;
执行结果:
原标题:oracle自定义异常
关键词:oracle