Oracle Custom Error Codes Range
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring oracle raise_application_error range developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Difference Between Raise And Raise_application_error In Oracle
x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join
Pragma Exception_init
them; it only takes a minute: Sign up Oracle: Raise custom error messages without conflict with default error IDs? up vote 0 down vote favorite I'm writing an application using .Net. The application is connected to Oracle database and handles
Oracle Exception
oracle error messages. It works like this Try 'Do oracle operations Catch Ex as OracleException 'Handle exception End Try In the database side, I'm creating some customized error messages : raise_application_error (-20000, 'Custom Error description'); My problem is that : I don't want any conflict between the Error number of default Oracle errors and mine. So I tried to use an Error Number outside default oracle interval (From 0000 to 62001) but I'm getting the error "Ora-21000 error number sqlerrm argument to raise_application_error. 63000 is out of range" Does anyone have a workaround ? oracle share|improve this question edited Dec 25 '13 at 4:42 asked Dec 25 '13 at 4:21 Thomas Carlton 8863924 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted The user-defined error code range that you can use is in the range -20000..-20999. So, any values you assign in that range will work. You can read more about exception in the Oracle Docs share|improve this answer answered Dec 25 '13 at 4:44 OldProgrammer 6,19931025 add a comment| up vote 4 down vote The only error codes that it is valid for your application to use are -20000 to -20999 (giving you a range of 1000 error codes). You can use any of those without conflicting with Oracle database error codes. Some of Oracle's internal packages, though, do use error codes in that range. share|improve this answer answered Dec 25 '13 at 4:44 Justin Cave 160k14204250 Interesting. Justin, I had no idea that Oracle's internal packages used error codes in the range -20000 to -20999. That seems....odd. Do you know of an example? Thanks! –Mark J. Bobak Dec 25 '13 at 7:03 @MarkJ.Bobak - One example is that dbms_scheduler.drop_job can throw an ORA-20001 error if the job name is invalid matthiashoys.wordpress.com/2013/04/10/… –Justin Cave Dec 26 '13 at 19:28 Thanks Justin, I
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us ora-20001 Learn more about Stack Overflow the company Business Learn more about hiring developers oracle error codes or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack pragma autonomous_transaction Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Oracle: Raise custom error messages without conflict with http://stackoverflow.com/questions/20769020/oracle-raise-custom-error-messages-without-conflict-with-default-error-ids default error IDs? up vote 0 down vote favorite I'm writing an application using .Net. The application is connected to Oracle database and handles oracle error messages. It works like this Try 'Do oracle operations Catch Ex as OracleException 'Handle exception End Try In the database side, I'm creating some customized error messages : raise_application_error (-20000, 'Custom Error description'); My problem is that : I don't want http://stackoverflow.com/questions/20769020/oracle-raise-custom-error-messages-without-conflict-with-default-error-ids any conflict between the Error number of default Oracle errors and mine. So I tried to use an Error Number outside default oracle interval (From 0000 to 62001) but I'm getting the error "Ora-21000 error number argument to raise_application_error. 63000 is out of range" Does anyone have a workaround ? oracle share|improve this question edited Dec 25 '13 at 4:42 asked Dec 25 '13 at 4:21 Thomas Carlton 8863924 add a comment| 2 Answers 2 active oldest votes up vote 3 down vote accepted The user-defined error code range that you can use is in the range -20000..-20999. So, any values you assign in that range will work. You can read more about exception in the Oracle Docs share|improve this answer answered Dec 25 '13 at 4:44 OldProgrammer 6,19931025 add a comment| up vote 4 down vote The only error codes that it is valid for your application to use are -20000 to -20999 (giving you a range of 1000 error codes). You can use any of those without conflicting with Oracle database error codes. Some of Oracle's internal packages, though, do use error codes in that range. share|improve this answer answered Dec 25 '13 at 4:44 Justin Ca
here for a quick overview of the site Help Center Detailed http://stackoverflow.com/questions/6020450/oracle-pl-sql-raise-user-defined-exception-with-custom-sqlerrm answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss error codes Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Oracle PL/SQL - Raise User-Defined Exception With Custom SQLERRM up vote 45 down vote favorite 21 Is it possible to oracle custom error create user-defined exceptions and be able to change the SQLERRM? For example: DECLARE ex_custom EXCEPTION; BEGIN RAISE ex_custom; EXCEPTION WHEN ex_custom THEN DBMS_OUTPUT.PUT_LINE(SQLERRM); END; / The output is "User-Defined Exception". Is it possible to change that message? EDIT: Here is some more detail. I hope this one illustrates what I'm trying to do better. DECLARE l_table_status VARCHAR2(8); l_index_status VARCHAR2(8); l_table_name VARCHAR2(30) := 'TEST'; l_index_name VARCHAR2(30) := 'IDX_TEST'; ex_no_metadata EXCEPTION; BEGIN BEGIN SELECT STATUS INTO l_table_status FROM USER_TABLES WHERE TABLE_NAME = l_table_name; EXCEPTION WHEN NO_DATA_FOUND THEN -- raise exception here with message saying -- "Table metadata does not exist." RAISE ex_no_metadata; END; BEGIN SELECT STATUS INTO l_index_status FROM USER_INDEXES WHERE INDEX_NAME = l_index_name; EXCEPTION WHEN NO_DATA_FOUND THEN -- raise exception here with message saying -- "Index metadata does not exist." RAISE ex_no_metadata; END; EXCEPTION WHEN ex_no_metadata THEN DBMS_OUTPUT.PUT_LINE('Exception will be handled by handle_no_metadata_exception(SQLERRM) procedure here.'