Re: NO_DATA_FOUND EXCEPTION

From: <James>
Date: 1995/04/25
Message-ID: <1995Apr25.113813.9287_at_newton.ccs.tuns.ca>#1/1


In article <D7JMpG.MGD_at_lanier.com> dvick_at_lanier.com (Don Vick) writes:
>In article <3nbutc$4sp_at_news.annex.com>, <sanctus2_at_annex.com> wrote:
>>In PL/SQL, if I do a SELECT INTO or a FETCH that returns 0 records, the
>>NO_DATA_FOUND EXCEPTION is raised. That's all well and good but what do
>>I do with it? If I write code to only do something if I RETRIEVE
>>records, why can't I ignore the NO_DATA_FOUND? It ends up generating an
>>error in my trigger and rolls back my transaction.
>>
>>I want to be able to retrieve no records WITHOUT erroring out my trigger.
>>
>
>One approach would be to encapsulate the retrieval in a procedure. Handle
>the exception in the procedure and pass a status code back to the trigger,
>or return a null value to indicate NO DATA FOUND.
>
>--------------------------------------------------------
>Donald E. Vick (dvick_at_lanier.com, dvick_at_crl.com)
>Voice: (404) 493-2194 Fax: (404) 493-2399

How about doing a COUNT (*) first.
If the count > 0 then process
else skip;

James Richard (JRICHARD_at_TUNS.CA)
"No Assembler Required!" Received on Tue Apr 25 1995 - 00:00:00 CEST

Original text of this message