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
set serveroutput on declare a number(5); b number(5); c number(5); begin a:=&a; b:=&b; c:=a/b; dbms_output.put_line(c); exception when zero_divide then d

Understanding Nested Tables Within the database, the nested tables can be considered as one-column database tables. The Oracle stores the rows of a nested table in no specific o

Use the MASCOT tables CREDITRS, PORDS and PAYMENTS to write SQL queries to solve the following business problems. These tables / data are available to you via the USQ Oracle server

Effects of NULL Operator As a general rule-but not a universal one-if NULL is an argument to an invocation of a system-defined read-only operator, then NULL is the result of t

PRIMARY KEY: PRIMARY KEY  indicates that the table is subject to a key constraint, in this case declaring that no two rows in the table assigned to ENROLMENT can ever have the

Effects of NULL for union - SQL The treatment of NULL in invocations of EXCEPT is as for UNION. This is different from its treatment in those of NOT IN and quantified compari

Scoping Within the similar scope, all the declared identifiers should be unique. So, even if their datatypes differ, the variables and parameters cannot share the similar name.

Fetching with a Cursor The FETCH statements retrieve the rows in the result set one at a time. After each and every fetch, the cursor advance to the next row in the result set

UTL_FILE: The Package UTL_FILE permits your PL/SQL programs to read & write operating system (OS) text files. It gives a restricted version of the standard OS stream file I/O,

Package Specification The package specifications contain the public declarations. The scopes of these declarations are local to your database representation and global to the