oracle plsql custom exception

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 thenDBMS_OUTPUT.PUT_LINE ( ' custom exception ' );
 End ;

 

Guess you like

Origin www.cnblogs.com/wangchuanfu/p/10987975.html