Error Handling

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email

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 errors meaningful to your PL/SQL block.

With most programming languages, unless you disable error checking, a run time error such a "stack overflow "or" division by zero", stops normal processing and returns control to the operating system. With PL/SQL, a mechanism called exception handling lets you "bullet proof" a block so that it can continue operating in the presence of errors.

What is an Exception?

In PL/SQL a warning or error is called an exception. Exceptions can be internally defined (by the run time system) or user defined. When an exception is raised, processing jumps to the exception handlers An exception handler is a sequence of statements to be processed when a certain exception occurs. When an exception handler is complete, processing of the block terminates.

Why use Exceptions?
Using exception for error handling has the following advantages
An exception
Can handle errors conveniently without the need to code multiple checks.
Improves readability by isolating error handling routines
Improves reliability, i.e., handles an exception when it is raised anywhere in the block.

How to use Exceptions?
Predefined Internal Exceptions

An internal exception is raised implicitly whenever the PL/SQL block violates a ORACLE rule exceeds a system dependent limit. Every ORACLE error has a number, but exception must be hand by name. So PL/SQL predefines some common errors as exceptions. Such predefined exceptions declared globally by PL/SQL.

For example, the predefined exception STORAGE ERROR is raised when PL/SQL runs out of memory NO DATA FOUND is raised when a SELECT statement returns no rows, and ZERO DIVIDE raised if a number is divided by zero Thus Internal Exceptions
correspond to approximately 20 common ORACLE errors.
are raised automatically by PL/SQL in response to an ORACLE error.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.