Oracle database exception type and code

Source: Internet
Author: User
Tags case statement error handling exception handling
Oracle database exception type and code

Exception Oracle Error SQLCODE Value
Access_into_null
ORA-06530
-6530

Case_not_found
ORA-06592
-6592

Collection_is_null
ORA-06531
-6531

Cursor_already_open
ORA-06511
-6511

Dup_val_on_index
ORA-00001
-1

Invalid_cursor
ORA-01001
-1001

Invalid_number
ORA-01722
-1722

Login_denied
ORA-01017
-1017

No_data_found
ORA-01403
+100

not_logged_on
ORA-01012
-1012

Program_error
ORA-06501
-6501

Rowtype_mismatch
ORA-06504
-6504

Self_is_null
ORA-30625
-30625

Storage_Error
ORA-06500
-6500

Subscript_beyond_count
ORA-06533
-6533

Subscript_outside_limit
ORA-06532
-6532

Sys_invalid_rowid
ORA-01410
-1410

Timeout_on_resource
ORA-00051
-51

Too_many_rows
ORA-01422
-1422

Value_error
ORA-06502
-6502

Zero_divide
ORA-01476
-1476

No_data_found
Indicates that the select does not query to a row of data that satisfies the criteria.
Others
Represents any error beyond the scope of Oracle predefined errors, Oracle uses this "others" to catch all unknown errors. You can use the Sqlcode function, where the SQLERRM function displays error codes and error messages in the error-handling module. Also, others processing must be the last error handling of a block, otherwise, others processing has a higher priority and a larger power, which captures all errors, including predefined Oracle errors and non-predefined Oracle errors.
Too_many_rows
Oracle's implicit cursor, which can retrieve only one row of data at a time, and when an implicit cursor is used, the exception handling mechanism throws the Too_many_rows type exception if it detects that the data returned by the cursor is more than a row of data.
Dup_val_on_index
On an index, duplicate values appear.
Value_error
In a Target field, the data length or range of data that goes beyond the defined length or range of the target field, such as inserting the ' 8613905180088 ' string into the UserID field, and UserID defined as VARCHAR2 (10), this exception occurs.

Brief descriptions of the predefined exceptions follow:

Exception raised when ...
Access_into_null
Your program attempts to assign values to the attributes of a uninitialized (atomically null) object.

Case_not_found
None of the choices in the clauses of a case statement be selected, and there is no ELSE clause.

Collection_is_null
Your program attempts to apply collection methods the other than EXISTS to a uninitialized (atomically null) n ested table or Varray, or the attempts to assign values to the elements of the uninitialized of d table or Varray.

Cursor_already_open
Your program attempts to open a already open cursor.  A cursor must is closed before it can be reopened.  A cursor for loop automatically opens the cursor to which it refers. So, your program cannot open that cursor inside the loop.

Dup_val_on_index
Your program attempts to store duplicate values in a database column, which is constrained by a unique Inde X.

Invalid_cursor
Your program attempts a illegal cursor operation such as closing an unopened.

Invalid_number
In a SQL statement, the conversion of a character string to a number fails because the string does not  represent a valid number.  (In procedural statements, Value_error is raised.)  This exception is also raised the limit-clause expression into a bulk FETCH statement does not evaluate to a positive number.

Login_denied
Your program attempts to log in to Oracle with a invalid username and/or password.

No_data_found
A SELECT into statement returns no rows, or your program references a deleted element in a nested table  or a uninitialized element in a index-by table.  SQL aggregate functions such as AVG and SUM always return a value or a null.  So, a SELECT into statement which calls an aggregate function never raises no_data_found. The FETCH statement is expected to return no rows eventually and so when this happens, no exception is raise D.

not_logged_on
Your program issues a database call without being connected to Oracle.

Program_error
Pl/sql has an internal problem.

Rowtype_mismatch
The host cursor variable and PL/SQL cursor variable involved in a assignment have incompatible return type  S. For example, where an open host cursor variable was passed to a stored subprogram, the return types of The actual and formal parameters must be compatible.

Self_is_null
Your program attempts to call a, on a null instance.  This is, the built-in parameter SELF (which is always the "a", "parameter to a") is Null.

Storage_Error
Pl/sql runs out of memory or memory has been.

Subscript_beyond_count
Your program references a nested table or Varray element using a index number larger than the number of Elements in the collection.

Subscript_outside_limit
Your program references a nested table or Varray element using ' index number ( -1 for example) ' is Outside the legal range.

Sys_invalid_rowid
The conversion of a character string into a universal rowID fails because the character string does not r Epresent a valid ROWID.

Timeout_on_resource
A time-out occurs while Oracle are waiting for a resource.

Too_many_rows
A SELECT into statement returns more than one row.

Value_error
An arithmetic, conversion, truncation, or size-constraint error occurs.  For example, where your program selects a column value into a character variable, if the value is longer  than the declared length of the variable, pl/sql aborts the assignment and raises. In procedural statements, Value_error are raised if the conversion of a character string into a number fail S. (in SQL statements, Invalid_number is raised.)

Zero_divide
 your  program  attempts  to  divide  a  number  by  zero.  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.