Advantages of exceptions, PL-SQL Programming

Advantages of Exceptions

Using the exceptions for the error handling has many benefits. Without an exception handling, every time you issue a command, you should ensure for the execution errors:

BEGIN

SELECT ...

-- check for 'no data found' error

SELECT ...

-- check for 'no data found' error

SELECT ...

-- check for 'no data found' error

The Error processing is not clearly separated from general processing; nor is it robust. If you ignore to code a check, the error goes unobserved and is possible to cause other, apparently unrelated errors. With the exceptions, you can handle errors correctly without the requirement to code the multiple checks, which is as shown:

BEGIN

SELECT ...

SELECT ...

SELECT ...

...

EXCEPTION

WHEN NO_DATA_FOUND THEN -- catches all 'no data found' errors

The Exceptions improve readability by letting you isolate the error-handling routines. The primary algorithm is not covered by error recovery algorithms. The Exceptions also improve reliability. You do not need to worry about checking for an error at every point it might occur. An exception handler is just adding to your PL/SQL block. If the exception is still raised in that block or any sub-block, you can be definite it will be handled.

Posted Date: 10/5/2012 5:04:45 AM | Location : United States







Related Discussions:- Advantages of exceptions, Assignment Help, Ask Question on Advantages of exceptions, Get Answer, Expert's Help, Advantages of exceptions Discussions

Write discussion on Advantages of exceptions
Your posts are moderated
Related Questions
Remote Operations: As the illustration shows below, the PL/SQL subprograms can execute the dynamic SQL statements which refer to the objects on a remote database: PROCEDURE

Row Operators The Row operators return or reference the particular rows. ALL retains the duplicate rows in the result of a query or in an aggregate expression. The DISTINCT el

3CX PBX sync Windows Service Project Description: !! You require access to a commercial version of the 3CX PBX system in order to be able to program the API !! !! You requ

Using a join on 2 tables, select all columns and 10 rows from the 2 tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_

Fetching from a Cursor Variable The FETCH statement retrieve rows one at a time from the product set of a multi-row query. The syntax for the same is as shown: FETCH {curso

Committing and Rolling Back The COMMIT and ROLLBACK end the active autonomous transaction but do not exit the autonomous routine. As the figure shows, if one transaction ends,

This is a Customer Management project. Customer data is presented in a text file. The program will load this text data into its DB columns. The data mapping is user definable. User

Example of Check Constraints Example: Workaround for when subqueries not permitted in CHECK constraints CREATE FUNCTION NO_MORE_THAN_20000_ENROLMENTS ( ) RETURNS BOOLEAN

Using the student and faculty tables create a select query that outputs all students for a specific advisor. Generate the execution plan, select out the explain plan . Create an

Error Handling The PL/SQL makes it easy to detect and process the predefined and user-defined error conditions known as exceptions. Whenever an error occurs, an exception is ra