Please note that all the examples in this series have been tested only with Oracle 10g and not with all the previous versions of Oracle. Refer to the documentation of the respective version you are using if any programs fail to execute. Introduction to Exception Handling Before going to exception handling, let us first determine all the possible ways to get errors. Errors may occur in PL/SQL (of course, not only PL/SQL) in several possible ways including hardware failures, network failures, bugs in programs, out of memory and several other reasons. We may not know which error has been raised at what moment. But we need to handle all such errors and provide some meaningful messages to the user (instead of making the user horrified with jargon-filled error messages). An exception is generally a runtime error which gets raised by PL/SQL runtime when a PL/SQL block is in the process of execution. Handling the exception consists of trapping the error (or exception) and providing a meaningful explanation to the user without showing the weird error message raised by the PL/SQL run-time. This doesn't mean only providing meaningful explanations; we can take certain actions (programmatically) when an error occurs at runtime. Basically, there exist two types of exceptions:
blog comments powered by Disqus |