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
IN Mode An IN parameter pass the values to the subprogram being called. Within the subprogram, an IN parameter acts like a constant. And hence, it cannot be assigned a value.

EXECUTE IMMEDIATE Statement   The EXECUTE IMMEDIATE statement prepare (parses) and instantly executes a dynamic SQL statement or an anonymous PL/SQL block. Syntax:

Using PRIOR and NEXT The PRIOR(n) returns the index number that precede index n in a collection. The NEXT(n) returns the index number which succeed the index n. If n has no pr

Using RENAME in combination with JOIN - SQL Example gives pairs of ids of students having the same name, by joining two renamings of IS_CALLED. Example gives an equivalent ex

Anatomy of a Command Figure, showing a simple SQL command, is almost identical to its counterpart in the theory book. The only difference arises from the fact that SQL uses a

Parameter Modes: You do not require to specify a parameter mode for the input bind arguments (those used, for illustration, in the WHERE clause) as the mode defaults to IN. Th

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

Short-Circuit Evaluation When computing a logical expression, the PL/SQL uses short-circuit evaluation. That is, the PL/SQL stops computing the expression as soon as the result

EXCEPTION_INIT Pragma The pragma EXCEPTION_INIT relates an exception name with an Oracle error number. Which allow you to refer to any internal exception by the name and to wri

Existential Quantification - SQL Existential quantification-stating that something is true of at least one object under consideration-can be expressed by OR(r,c), meaning tha