Re: PL-SQL: Exception NO_DATA_FOUND or %NOTFOUND

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sun, 7 Jul 2002 09:14:08 +0200
Message-ID: <uifqjapc3uhu5d_at_corp.supernews.com>


[Quoted] "Henk Hultink" <hhu_at_stopspam.stoas.nl> wrote in message news:3d259174$1_at_news.wau.nl...
> Hi,
>
> Does anyone know if there is a difference between:
>
> OPEN <cursor>;
> FETCH <cursor> INTO <variable>;
> EXCEPTION
> WHEN NO_DATA_FOUND THEN
> ....
>
> and
>
> OPEN <cursor>;
> FETCH <cursor> INTO <variable>;
> WHEN <cursor>%NOTFOUND THEN
> ....
>
> I remember having heard that thers IS a difference; however I can't find
it
> in the manuals.
>
> Regards,
> --
> H. Hultink
> Software Engineer
> Stoas, Division IOAL
> Wageningen, The Netherlands
> "Activating Knowledge"
> http://www.stoas.nl
>
> e-mail: hhu_at_stopspam.stoas.nl
>
>

Basically there is no difference.
[Quoted] The no_data_found exception is raised when using implicit cursors. [Quoted] The no_data_found condition is raised when using explicit cursors, you [Quoted] always need to handle those. The code you provided is incorrect. It is <CURSOR>%NOTFOUND and as that isn't an exception, it is *IF* <CURSOR>%NOTFOUND
Most of this can be prevented by using CURSOR FOR loops.

Hth

--
Sybrand Bakker
Senior Oracle DBA

to reply remove '-verwijderdit' from my e-mail address
Received on Sun Jul 07 2002 - 09:14:08 CEST

Original text of this message