预定义异常
用户自定义异常
do some stuff
Exception
when no_data_found then
dbms_output.put_line('没有数据');
when zero_divide then
dbms_output.put_line('除数为0');
end;
用户自定义异常
declare
Dup_Value Exception;
pragma Exception_init(Dup_Value,-1)
iCount int :=0;
begin
select count(*) into iCount from emp ;
if (iCount > 0 )
then
raise Dup_Value;
end if;
exception
when Dul_Value
DBMP_OUTPUT.put_line('重复的值');
end;
Raise_Application_Error(代码,字符信息<2048)