oracle plsql 自定义异常

set serveroutput on

DECLARE

cursor cemp is select ename from emp where deptno=50;
pename emp.ename%type;


--自定义异常
no_emp_found exception;
begin

open cemp;


fetch cemp into pename;




if 
cemp%notfound then 
raise no_emp_found;
end if;
close cemp;
exception 

when 
no_emp_found then dbms_output.put_line('自定义异常');
end;

 

posted @ 2019-06-07 12:43  小啊菜鸡  阅读(551)  评论(0编辑  收藏  举报