异定义异常就是那些在pl/sql中已经定义好并给予了异常名称的异常。它们全部放在pl/sql自带的标准包中,这样pl/sql程序员就无需再次定义。
oracle中总共有如下21种标准预定义异常:
oracle异常名称
错误号
说明
dup_val_on_index
ora-00001
you tried to execute an insert or update statement that has created a duplicate value in a field restricted by a unique index.试图破坏一个唯一性限制
timeout_on_resource
ora-00051
you were waiting for a resource and you timed out.在等待资源时发生超时
transaction_backed_out
ora-00061
the remote portion of a transaction has rolled back.由于发生死锁事务被撤消
invalid_cursor
ora-01001
you tried to reference a cursor that does not yet exist. this may have happened because you’ve executed a fetch cursor or close cursor before opening the cursor.试图使用一个未打开的游标
not_logged_on
ora-01012
you tried to execute a call to oracle before logging in.没有连接到oracle
login_denied
ora-01017
you tried to log into oracle with an invalid username/password combination.无效的用户名/口令
no_data_found
ora-01403
too_many_rows
ora-01422
select into 返回多行you tried to execute a select into statement and more than one row was returned.
zero_divide
ora-01476
试图被零除you tried to divide a number by zero.
invalid_number
ora-01722
转换一个数字失败you tried to execute an sql statement that tried to convert a string to a number, but it was unsuccessful.
storage_error
ora-06500
内存不够或内存被破坏引发的内部错误you ran out of memory or memory was corrupted.
program_error
ora-06501
内部错误,需重新安装数据字典视图和pl/sql包this is a generic “contact oracle support” message because an internal problem was encountered.
value_error
ora-06502
赋值操作,变量长度不足,触发该异常you tried to perform an operation and there was a error on a conversion, truncation, or invalid constraining of numeric or character data.
rowtype_mismatch
ora-6504
宿主游标变量与 pl/sql变量有不兼容行类型
cursor_already_open
ora-06511
试图打开一个已打开的游标you tried to open a cursor that is already open.
access_into_null
ora-6530
试图为null 对象的属性赋值
collection_is_null
ora-6531
试图给没有初始化的嵌套表变量或者varry变量赋值
subscript_outside_limit
ora-6532
对嵌套或varray索引使用了负数
subscript_beyond_count
ora-6533
对嵌套或varray索引的引用大于集合中元素的个数
,
