Re: PL-SQL: Exception NO_DATA_FOUND or %NOTFOUND

From: Thomas Kyte <tkyte_at_oracle.com>
Date: 7 Jul 2002 10:28:42 -0700
Message-ID: <ag9toa02fqn_at_drn.newsguy.com>


In article <felgiucddh36binb023b8amh786usmm6s8_at_4ax.com>, Sybrand says...
>
>On 7 Jul 2002 06:49:39 -0700, Thomas Kyte <tkyte_at_oracle.com> wrote:
>
>>incorrect.
>>
>> open c;
>> fetch c into ...;
>> if c%notfound then .....
>>
>>the above code makes sense and properly detects the no data found condition
>>whereas:
>>
>> open c;
>> begin
>> fetch c into ...;
>> exception
>> when no_data_found then .....
>> end;
>>
>>won't "work" -- it's a bug in the code. It'll never ever detect that "no data
>>was found" since the no_data_found exception is raised only when you use a
>>SELECT INTO.
>
>
>I did differentiate between exception and condition, did I? I never
>said a FETCH INTO raises the NO_DATA_FOUND exception, did I?
>Maybe I shouldn't have used the phrase 'raise condition'
>You could also argue about 'night and day different'

You said

<quote>
Basically there is no difference.
The no_data_found exception is raised when using implicit cursors. The no_data_found condition is raised when using explicit cursors, you always need to handle those.
</quote>

I see it now -- you called it a no_data_found condition, that's what tripped me up. There is a no_data_found exception -- and a %NOTFOUND condition. It was the use of no_data_found along with the word "raised" with explicit cursors -- conditions aren't really raised, exceptions are and there isn't really a condition no_data_found.

sorry for the confusion on that.

>In *both* cases sqlnet on the client side receives the ora-1403 error
>message. And it has always mightily suprised me error messages are
>being sent from server to client *in full*, as you will *always* get
>ora-1403, either expected or unexpected. Looks a waste of resources to
>me. But then we are probably both nitpicking.
>
>Regards
>
>
>
>Sybrand Bakker, Senior Oracle DBA
>
>To reply remove -verwijderdit from my e-mail address

--
Thomas Kyte (tkyte_at_oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sun Jul 07 2002 - 19:28:42 CEST

Original text of this message