How exceptions propagate in pl/sql programming?, PL-SQL Programming

How Exceptions Propagate ?

Whenever an exception is raised, and if the PL/SQL cannot find a handler for it in the present subprogram or block, the exception propagates. That is, the exceptions reproduce it in the succeeding enclosing blocks until a handler is found or there are no more blocks to search. In the latter situation, the PL/SQL returns an unhandled exception error to the host atmosphere.

Though, exceptions cannot propagate across the remote procedure calls (RPCs). As a result, the PL/SQL block cannot catch an exception raised by a remote subprogram.

1751_exceptions propogate.png

 

581_exceptions propogate1.png

 

2358_exceptions propogate2.png

An exception can propagate additional than its scope, that is, additional than the block in which it was declared. Consider the illustration which is as shown below:

BEGIN

...

DECLARE ---------- sub-block begins

past_due EXCEPTION;

BEGIN

...

IF ... THEN

RAISE past_due;

END IF;

END; ------------- sub-block ends

EXCEPTION

...

WHEN OTHERS THEN

ROLLBACK;

END;

As the block in which the exception past_due was declared has no handler, the exception propagates to the enclosing block. But, according to the scope rules, the enclosing blocks cannot reference the exceptions declared in a sub-block. Therefore, only an OTHERS handler can catch the exception.

Posted Date: 10/5/2012 5:20:43 AM | Location : United States







Related Discussions:- How exceptions propagate in pl/sql programming?, Assignment Help, Ask Question on How exceptions propagate in pl/sql programming?, Get Answer, Expert's Help, How exceptions propagate in pl/sql programming? Discussions

Write discussion on How exceptions propagate in pl/sql programming?
Your posts are moderated
Related Questions
Using COMMIT The COMMIT statements end the present transaction and make permanent any changes made during that transaction. Till you commit the changes, other users cannot acc

Entering and Exiting If you enter the executable part of an autonomous routine, the major transaction suspends. When you exit the routine, the major transaction resumes. To ex

Cursor Variables Similar to a cursor, cursor variable points to the current row in the result set of a multi-row query. But, dissimilar a cursor, a cursor variable can be opene

FOR-LOOP While the number of iterations through a WHILE loop is unknown till the loop completes, then the number of iterations through a FOR loop is known before the loop is ent

Rollback Behavior When a FORALL statement fails, the database changes are rolled back to an implicit savepoint marked before each of the SQL statement execution. The Changes t

Implicit Rollbacks Before execute the INSERT, UPDATE, or DELETE statement, the Oracle marks an implicit savepoint . When the statement fails, the Oracle rolls back to the save

Use of COUNT in SQL It describes and discusses various general methods of expressing constraints, eventually noting that support for "=" with relation operands is sufficient f

Loop Labels Like the PL/SQL blocks, loops can also be labeled. The label, an undeclared identifier enclosed by double angle brackets, should appear at the beginning of the LOOP

Initial thought process: Design a script which was simple and user friendly. Integrate procedures/functions to extract data under the hood. I focused on giving the user the opt

Using Cursor Attributes To process the SQL data manipulation statements, the SQL engine must opens an implicit cursor named SQL. This cursor's attributes (%FOUND, %NOTFOUND, %