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: NO NO_DATA_FOUND ?!?!

Re: NO NO_DATA_FOUND ?!?!

From: Martin Haltmayer <Martin.Haltmayer_at_0800-einwahl.de>
Date: Wed, 06 Jun 2001 08:54:38 +0200
Message-ID: <3B1DD3AE.A4BB5BC0@0800-einwahl.de>

This is the defined behaviour of exception propagation. The no_data_found exception inside the function is propagated to the select.

If a "select noex from dual" catches the no_data_found exception it purely says "no rows found". This is the way the no_data_found is handled by the sql engine that executes the select.

Martin

Martin Drautzburg wrote:
>
> Marcin Buchwald <Marcin.Buchwald_at_agora.pl> writes:
>
> > The function
> >
> > create function noex
> > return number
> > as
> > n number;
> > begin
> > select 1 into n from dual where 0=1;
> > n := 4; -- not executed!
> > return n;
> > end;
> >
> > should raise an NO_DATA_FOUND exception in my opinion. It answers
> > NULL however and ignores the rest of body code. The example concerns
> > pl/sql functions in general.
>
> This is hard to believe. I suppose your problem is elsewhere:
>
> SQL> create function noex
> return number
> as
> n number;
> begin
> select 1 into n from dual where 0=1;
> n := 4; -- not executed!
> return n;
> end; 2 3 4 5 6 7 8 9
> 10 /
> SQL> variable x number
> SQL> exec :x:= noex
> BEGIN :x:= noex; END;
>
> *
> ERROR at line 1:
> ORA-01403: no data found
> ORA-06512: at "ISB.NOEX", line 6
> ORA-06512: at line 1
  Received on Wed Jun 06 2001 - 01:54:38 CDT

Original text of this message

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