Oracle User Error Messages
Contents |
Churchill Run-time errors arise from design faults, coding mistakes, hardware failures, and many other sources. Although you cannot anticipate all possible errors, you can plan to handle certain kinds of
Oracle Error Handling
errors meaningful to your PL/SQL program. With many programming languages, unless you disable error ora error 12154 checking, a run-time error such as stack overflow or division by zero stops normal processing and returns control to the
Ora In Oracle
operating system. With PL/SQL, a mechanism called exception handling lets you "bulletproof" your program so that it can continue operating in the presence of errors. This chapter discusses the following topics: Overview of https://docs.oracle.com/cd/B28359_01/nav/lookup.htm?id=ERRMG PL/SQL Error Handling Advantages of PL/SQL Exceptions Predefined PL/SQL Exceptions Defining Your Own PL/SQL Exceptions How PL/SQL Exceptions Are Raised How PL/SQL Exceptions Propagate Reraising a PL/SQL Exception Handling Raised PL/SQL Exceptions Tips for Handling PL/SQL Errors Overview of PL/SQL Error Handling In PL/SQL, a warning or error condition is called an exception. Exceptions can be internally defined (by the run-time system) or user defined. Examples of internally https://docs.oracle.com/cd/A97630_01/appdev.920/a96624/07_errs.htm defined exceptions include division by zero and out of memory. Some common internal exceptions have predefined names, such as ZERO_DIVIDE and STORAGE_ERROR. The other internal exceptions can be given names. You can define exceptions of your own in the declarative part of any PL/SQL block, subprogram, or package. For example, you might define an exception named insufficient_funds to flag overdrawn bank accounts. Unlike internal exceptions, user-defined exceptions must be given names. When an error occurs, an exception is raised. That is, normal execution stops and control transfers to the exception-handling part of your PL/SQL block or subprogram. Internal exceptions are raised implicitly (automatically) by the run-time system. User-defined exceptions must be raised explicitly by RAISE statements, which can also raise predefined exceptions. To handle raised exceptions, you write separate routines called exception handlers. After an exception handler runs, the current block stops executing and the enclosing block resumes with the next statement. If there is no enclosing block, control returns to the host environment. In the example below, you calculate and store a price-to-earnings ratio for a company with ticker symbol XYZ. If the company has zero earnings, the predefined exception ZERO_DIVIDE is raised. This stops normal execution of th
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 http://stackoverflow.com/questions/20769020/oracle-raise-custom-error-messages-without-conflict-with-default-error-ids 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 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: Raise custom error messages without conflict with default error IDs? up vote 0 oracle error 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 any conflict between the Error number of default Oracle oracle error codes 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 Cave 160k14204250 Interesting. Justin, I had no idea that Oracle's internal packages used error codes in t