Get PC error-free in minutes
If you are seeing application error 20200 on your PC, then you should check out these recovery methods. You can use the RAISE_APPLICATION_ERROR procedure to print custom ORA error messages from stored routines. This allows you to report errors to your individual application and avoid throwing unhandled exceptions.
Oracle whoraise_application_error returnsA procedure to increase the number of current errors inyour applications. You can generate errors and send them in texton the chart starting from -20000 and continuing-20999 (total 1000 error numbers you can know).use). Below we will illustrate what is relevant to the useraise_application_errorProcedure.
Balance integer: equal to 24;
IF (nBalance <= 100) THEN
Raise_Application_Error (-20343, ‘Balance toolow.’);
In this example, the error number is usually -20343.fires if the value of nBalance is not more than 100,this results in a specific message that looks like this:
ORA-20343:The balance is also low.
%NotePredefined departure error codecannot be used in such a procedure.
7.Braise_application_error (-20000,”You cannot make changes toWeekend!!’);
1) Can we use the same error codes (e.g. -20000) only for single errors side? Scripting in multiple areas of PLSQL code?
You can. However, this did not always help – read on.
2) If we have to use the same error code everywhere, why do we use 1000? code?
3) What is the best way to start using error codes in the Raise Application? Error?
Why do we use raise application error?
The raise_application_error strategy allows you to bypass a custom coupon code block or saved program error. Using this procedure, you can report penalties to callers instead of returning unhandled exceptions.
Set some internal and default settings, stick with them – read on.
What are custom errors often used for? They are great for evaluating business problems (for example, a newly created client looks 950 years old or born with an eye to the future), while Oracle standard errors indicate problems with garden logic (for example, referencing an unknown client).
How do you raise application error?
A provider-specific variant that is associated with any error code before it is stored in a variable named SQLCODE. The RAISE_APPLICATION_ERROR procedure accepts user-defined error number values from -20000 to -20999. SQLCODE returned ineach of our error messages, SQL0438N.
Depending on your application’s model number, you may want to implement business scoring outside of the database, you may prefer to use the associated PL/SQL features to implement the institution logic in the database.
EXCEPTIONIf dup_val_on_indexthenRaise_application_error(-20000,'Failed to insert duplicates');IF OTHERTOGYESRaise_application_error(-20000,SQLCODE||'-'||SQLERRM);End;
First of all, you might be wondering what will you do if something goes wrong? Okay, you can print a really nice call stack to get the end user – and it’s completely useless. I’m talking about whether you can reduce all possible dilemmas to things the user needs to be able to solve (for example, choosing a different character for your name if you’re facing an exclusive constraint) and errors that the client can’t solve (for example, the user doesn’t exist, because there is a programming error).
I would say that it would be useful to distinguish errors in this way. If you find this particularly logical, then:
Wrap all exceptions in some custom BusinessError, such as -20000, so that the user can do something that matters. Use the error message to provide a meaningful description of the action to be taken (for example, “Please choose to just use a different login name” instead of “Unable to embedavoid duplicates”) – and your own application is already in the top 5%. р>
wrap all other exceptions as errors, technically -20001. In the event of an unexpected scientific error, your application can do one thing: log the error and display an important message “Something went wrong, but we’ll try to fix it” to the affected user. Very few users can read/read or be interested in Oracle Call Loads 🙂
I don’t really like the standard Oracle error messages. For example, a simple error about a violation can cause confusion. Suggest that my partner explicitly name all constraints to follow a good naming convention. In this case, you don’t have to deal with built-in Oracle errors, because they are executed in such a way that the application code archives them and informs the user that “something is wrong” n is simply not a business error.
This solution is very effective if you have implemented some business logic in a PL/SQL database. If someone prefers application server business logic, onexample. Hibernate, then you will have the pleasure of handling each constraint violation yourself. Workaround
This may require extensions if you are building a multilingual app. Business failures will certainly have meaningful and friendly messages and it resonates in first language. Either you may need to issue a message when working with multiple languages (and the privilege of choosing in the GUI) or embed your own translation file in the main file.
How do you resolve ORA 20000?
As mentioned earlier, the ORA-06512 error and the ORA-20000 error are likely to be co-located. To resolve these inconsistencies, the user must make the condition causing the errors reasonable, or perhaps write an exception handler. To start fixing the error stack, commit the code to the lines suggested in the error message.
Business error example (internal error, dup_val_on_index is considered a wrapped business error as it is mostly caused by individual invalid input)
procedure addUser(in_birthDate date, ) is pls_integer age=sysdate-in_birthDate;to begin if age >100 then raise_application_error(-20000,'Check your date of birth, you're so old!'); age elsif<0 then first date raise_application_error(-20000,'Birth cannot be in the future.'); done when; insert into .... oblige;an exception although then dup_val_on_index raise_application_error(-20000,'Please select a realth alternate username!');End;
You may want to customize the career bug reporting process:
CREATE OR REPLACEProcedure launch (in_message varchar2) isto begin raise_application_error (-20999, in_message);End;Get this software now and start surfing the web worry-free.