|
|
|
Re: begin end under exception [message #405142 is a reply to message #405140] |
Tue, 26 May 2009 08:52   |
prachij593
Messages: 266 Registered: May 2009
|
Senior Member |
|
|
DECLARE
a NUMBER;
B NUMBER;
BEGIN
SELECT dept_id
INTO a
FROM dept
WHERE 1 = 2;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
BEGIN
SELECT PRODUCT_ID
INTO B
FROM PRODUCT
WHERE 1 = 2;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DBMS_OUTPUT.PUT_LINE('D');
END;
END;
[EDITED by LF: fixed [code] tags]
[Updated on: Wed, 27 May 2009 03:01] by Moderator Report message to a moderator
|
|
|
|
Re: begin end under exception [message #405225 is a reply to message #405220] |
Wed, 27 May 2009 02:07  |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
ashoka_bl wrote on Wed, 27 May 2009 08:27 | I am bit curious about this, why do want this ?
|
This is a very valid code-construct.
Often, the fact that an exception occurs is used explicitly in code. For example, insert and handle the DUP_VAL_ON_INDEX instead of first checking whether the duplicate already exists in the table.
Then is would be very legit to continue your code (which is inside the exceptionhandler) and handle any exceptions that occur there too.
|
|
|