oracle ----自定义异常

来源:互联网 发布:师洋的淘宝店是正品吗 编辑:程序博客网 时间:2024/06/06 18:30

(1)declare 定义例外
(2)触发例外 raise ….
(3)例外处理部分

declare
too_low exception; –定义例外
v_sal number(20);
begin
select sal into v_sal from emp where empno = 5;
if v_sal>8000 then
raise too_low; –触发例外
end if;
dbms_output.put_line(v_sal);
exception –例外处理部分
when too_low then
dbms_output.put_line(‘员工工资太高……’);
end;

0 0
原创粉丝点击