Oracle exception when do nothing




















Improve this question. Add a comment. Active Oldest Votes. In these situations, NULL is your friend: [ Improve this answer. Community Bot 1 1 1 silver badge.

Perhaps worth adding that when others then null is considered poor practice except in very specific blocks where you really don't care whether a step worked or not, and when others then raise just throws away information about the error. Ananth N Ananth N 61 1 1 silver badge 2 2 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook.

Sign up using Email and Password. If you want to play around with various possible solutions, check out this code in myndf.

What information is displayed on the screen? What is displayed if you execute the same line of code a second time? You are working on a program that requires exclusive access to data in the EMP table. If you cannot immediately acquire the lock, you should simply print a message to try again later.

If you do acquire the lock, print the name of each employee using a loop. When you execute this block, you receive the following output, but you can successfully execute the new procedure on its own:.

Just about the most important information you can obtain about an error is the line number on which the error is raised. Which of the following statements accurately describes ways to obtain this information? Let the error go unhandled and then view the error stack displayed in standard output your screen, a web page, etc. You have been asked to record all errors that occur in your application so they can be examined later. You have decided to write your error information to a database table.

You create a procedure to write to the log as follows:. Only someone connected to the current session can see output sent to the log, and then only when the program has stopped executing. An attempt to send error data to this log can cause your program to block or be stopped.

Write a procedure that raises any error number passed to it, whether it be an Oracle error number like ORA , an application-specific error in the —20,XXX range , or your own positive error numbers. Perhaps you did not want to be constrained by the 1, error numbers Oracle offers. You noticed, instead, that the only positive numbers used for error handling are 1 and , leaving an awful lot for you.

Skip to main content. Table Already Exists? Statement 7. This handler doesn't hide the error - it immediately passes it along to the outer block. Why would you do this? Takeaway: don't handle unless you want to do something inside the handler, such as log the error information, raise a different exception or perform some corrective action. Statement 8. Statement 9.

I do not re-raise, so the error is swallowed up. But I also simply write non-useful information out to the screen. I bet not. And even if you could, surely you'd like to show more than a totally useful static piece of text?

Statement There are several reasons, described in the following sections. There are many situations in your program where you logically do not want to take any action. The only drawback is the ambiguity surrounding this solution: it is not clear to a person examining the program that you purposely took no action.

To produce a report based on a selection, you can code:. One would assume that the program is supposed to do nothing.

But because this is not explicitly stated in the code, one is left to wonder if perhaps there was an oversight.



0コメント

  • 1000 / 1000