Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: RAISED EXCEPTION not well caught

Re: RAISED EXCEPTION not well caught

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Mon, 08 Mar 2004 15:23:02 -0800
Message-ID: <1078788147.514087@yasure>


Peter Wu wrote:

> On 08/03/2004 4:13 PM, Daniel Morgan wrote:
> 

>> Peter Wu wrote:
>>
>>> Hello group,
>>>
>>> I'm new to Oracle PL/SQL.
>>>
>>> I have written a test script as follows.
>>>
>>> BEGIN
>>> select min(contract_start_date)
>>> into l_min_contract_start_date
>>> from contracts
>>> where customer_last_name = 'Bush';
>>>
>>> if (l_min_contract_start_date is null) then
>>> raise NO_DATA_FOUND;
>>> end if;
>>>
>>> BEGIN
>>>
>>> /* do something */
>>>
>>> EXCEPTION WHEN NO_DATA_FOUND THEN
>>> BEGIN
>>> /*
>>> do something to handle the exception within
>>> the nearest BEGIN
>>> */
>>> -- Exception Handler1
>>>
>>> END;
>>> END;
>>>
>>>
>>>
>>> EXCEPTION WHEN NO_DATA_FOUND THEN
>>> BEGIN
>>> /*
>>> do something to handle the excpetion raised by
>>> contract_start_date SELECT */
>>>
>>> -- Exception Handler2
>>>
>>> END;
>>> END; END;
>>>
>>>
>>> The problem I see is that when the NO_DATA_FOUND exception is raised
>>> after the SELECT, the program goes to Exception Handler1 instead of
>>> Exception Handler2 as I want it to.
>>>
>>> What was I missing? Any insight will be appreciated!
>>
>>
>> What is missing is a variable declaration
> 
> 
> That variable is declared properly.
> 

>> > select min(contract_start_date)
>> > into l_min_contract_start_date
>>
>> Where is l_min_contract_start_date defined?
> 
> 
> I omitted the declaration intentionally because that has nothing to do 
> with the problem I see.
> 

>> In the future post complete error messages and Oracle verison.
> 
> 
> I'm running Oracle 8i(8.1.7) on Sun Solaris8. Unfortunately, there is no 
> error message at all. Have you tried my code?

How could anyone try it when you cut it up and left out essential pieces? Post all the code and I will.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Mon Mar 08 2004 - 17:23:02 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US