1.系统异常
2.用户自定义异常
声明异常变量 exception;
条件满足抛出异常 raise 异常变量
捕捉异常 exception when 异常变量 then
3.警告
当没有异常产生时候,SQLCODE=0,反之为1.
SQLERRM---接受返回值,通常长度不超过512B.如果超过时,需要使用DBMS_UTILITY.FORMAT_ERROR_STACK.但在实际应用中,一般都会对其进行重新包装的。
RAISE_APPLICATION_ERROR(100000,'here is error'); 抛出异常
Cause: An attempt was made to specify a number not in the allowed range.
Action: Use an error number in the range of -20000 to -20999, inclusive.
处理
1.生成警告
2.插入记录alert.log
dbms_system.ksdwrt
dest: 1:写入跟踪文件;2:写入alert日志中;3:写入跟踪文件和alert日志中
tst: 文本信息.最大长度未知.在Oracle的一些版本上这里存在着内存溢出的漏洞,用的时候要慎重
3.邮件通知
utl_smtp
4.文件记录
5.表记录
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13880571/viewspace-1031674/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13880571/viewspace-1031674/