Oracle 11g Sql Error Codes
Contents |
Error Handling" in Oracle Database PL/SQL Language Reference. See the end of this chapter for TimesTen-specific considerations. The following topics are covered: Understanding
Oracle 11g Error Codes Pdf
exceptions Trapping exceptions Showing errors in ttIsql Differences in TimesTen: exception handing oracle error codes table and error behavior Understanding exceptions This section provides an overview of exceptions in PL/SQL programming, covering the following
Oracle Database Errors And Solutions
topics: About exceptions Exception types About exceptions An exception is a PL/SQL error that is raised during program execution, either implicitly by TimesTen or explicitly by your program. Handle https://docs.oracle.com/cd/B28359_01/nav/lookup.htm?id=ERRMG an exception by trapping it with a handler or propagating it to the calling environment. For example, if your SELECT statement returns multiple rows, TimesTen returns an error (exception) at runtime. As the following example shows, you would see TimesTen error 8507, then the associated ORA error message. (ORA messages, originally defined for Oracle Database, are similarly implemented by TimesTen.) https://docs.oracle.com/cd/E11882_01/timesten.112/e21639/exceptions.htm Command> DECLARE > v_lname VARCHAR2 (15); > BEGIN > SELECT last_name INTO v_lname > FROM employees > WHERE first_name = 'John'; > DBMS_OUTPUT.PUT_LINE ('Last name is :' || v_lname); > END; > / 8507: ORA-01422: exact fetch returns more than requested number of rows 8507: ORA-06512: at line 4 The command failed. You can handle such exceptions in your PL/SQL block so that your program completes successfully. For example: Command> DECLARE > v_lname VARCHAR2 (15); > BEGIN > SELECT last_name INTO v_lname > FROM employees > WHERE first_name = 'John'; > DBMS_OUTPUT.PUT_LINE ('Last name is :' || v_lname); > EXCEPTION > WHEN TOO_MANY_ROWS THEN > DBMS_OUTPUT.PUT_LINE (' Your SELECT statement retrieved multiple > rows. Consider using a cursor.'); > END; > / Your SELECT statement retrieved multiple rows. Consider using a cursor. PL/SQL procedure successfully completed. Exception types There are three types of exceptions: Predefined exceptions are error conditions that are defined by PL/SQL. Non-predefined exceptions include any standard TimesTen errors. User-defined exceptions are exceptions specific to your application. In TimesTen, these three types of exceptions are
Support Guide. A SQL statement cannot invoke SQLERRM. If a function invokes SQLERRM, and you https://docs.oracle.com/cloud/latest/db112/LNPLS/sqlerrm_function.htm use the RESTRICT_REFERENCES pragma to assert the purity of the function, then you cannot specify the constraints WNPS and RNPS. Note: DBMS_UTILITY.FORMAT_ERROR_STACK is recommended over SQLERRM, unless you use the FORALL statement with its SAVE EXCEPTIONS clause. For more information, see "Error Code and Error Message Retrieval". Topics Syntax error codes Semantics Examples Related Topics Syntax sqlerrm_function ::= Description of the illustration sqlerrm_function.gif Semantics error_code Expression whose value is an Oracle Database error code. For a list of Oracle Database error codes, see Oracle Database Error Messages. Default: error code associated with the current value of SQLCODE. Like SQLCODE, SQLERRM without oracle error codes error_code is useful only in an exception handler. Outside an exception handler, or if the value of error_code is zero, SQLERRM returns ORA-0000. If the value of error_code is +100, SQLERRM returns ORA-01403. If the value of error_code is a positive number other than +100, SQLERRM returns this message: -error_code: non-ORACLE exception If the value of error_code is a negative number whose absolute value is an Oracle Database error code, SQLERRM returns the error message associated with that error code. For example: BEGIN DBMS_OUTPUT.PUT_LINE('SQLERRM(-6511): ' || TO_CHAR(SQLERRM(-6511))); END; / Result: SQLERRM(-6511): ORA-06511: PL/SQL: cursor already open If the value of error_code is a negative number whose absolute value is not an Oracle Database error code, SQLERRM returns this message: ORA-error_code: Message error_code not found; product=RDBMS; facility=ORA For example: BEGIN DBMS_OUTPUT.PUT_LINE('SQLERRM(-50000): ' || TO_CHAR(SQLERRM(-50000))); END; / Result: SQLERRM(-50000): ORA-50000: Message 50000 n