異定義異常就是那些在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 |
SELECT INTO沒有找到資料You tried one of the following: You executed a SELECT INTO statement and no rows were returned.You referenced an uninitialized row in a table.You read past the end of file with the UTL_FILE package. |
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索引的引用大於集合中元素的個數 |