pl/sql自定义异常

来源:互联网 发布:mac如何导入照片 编辑:程序博客网 时间:2024/06/14 22:28
--pl/sql自定义异常
create or replace procedure update_sal(emp_no_in in emp.empno%type)
is
--定义一个异常
myex exception;
begin
   update emp set sal = sal +1000 where empno=emp_no_in;
   --sql%notfound表示没有update
   --raise myex;触发myex
   if sql%notfound then
     raise myex;
   end if;
   exception 
       when myex then
         dbms_output.put_line('pl/sql自定义异常catch');
end;
0 0
原创粉丝点击