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: Michel Cadot <micadot_at_netcourrier.com>
Date: Tue, 15 May 2001 10:36:27 +0200
Message-ID: <9dqpqg$14f$1@s1.read.news.oleane.net>

"Marcin Buchwald" <Marcin.Buchwald_at_agora.pl> a écrit dans le message news: 3B00E4E2.EB532A59_at_agora.pl...
> 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.
>
> I need tho catch NO_DATA_FOUND in pl/sql function.
> What to do?
>
> Marcin.
>

 create or replace function noex
 return number
 as

    n number;
 begin

    select 1 into n from dual where 0=1;     n := 4; -- not executed!
    return n;
 exception

    when no_data_found then

       return 0;
 end;
/

--
Have a nice day
Michel
Received on Tue May 15 2001 - 03:36:27 CDT

Original text of this message

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