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
Defining and Declaring Collections To create the collections, you must define a collection type, and then declare the collections of that type. You can define the VARRAY types a

We are seeking a freelance consultant that is familiar with Appgen applications. We require exporting all our data into a format appropriate for importing into SAP Business One. Pl

Create the four tables and populate them with the given data. Answer the following queries in SQL. 1. Get all part-color/part-city combinations. Note: Here and subsequently, the

%NOTFOUND The %NOTFOUND is the logical opposite of the %FOUND. The %NOTFOUND yields TRUE when an INSERT, UPDATE, or DELETE statement affected no rows, or the SELECT INTO state

Semijoin and Composition - SQL For semijoin, the dyadic relational operator MATCHING, defined thus: r1 MATCHING r2, where r1 and r2 are relations such that r1 JOIN r2 is de

Closing a Cursor The CLOSE statements disable the cursor, and the result set becomes undefined. An illustration of the CLOSE statement as shown: CLOSE c1;

What Is a Collection The collection is an ordered group of elements, all of similar type (for e.g. the grades for a class of students). Each element has a unique subscript whic

Data Types in SQL - Decimal DECIMAL, NUMERIC, REAL, FLOAT and various other terms for various sets of rational numbers. When these key words are specified for the declared typ

%NOTFOUND The %NOTFOUND is logical, opposite of the %FOUND. The %NOTFOUND yields FALSE if the last fetch returned a row, or TRUE when the final fetch failed to return a row. I

Parameter and Keyword Description: SQL: This SQL is the name of the implicit SQL cursor. %FOUND: This attribute results TRUE if an INSERT, DELETE, or UPDATE state