Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: NO DATA FOUND ERROR IN FUNCTION USING INTO? ORA-01403

Re: NO DATA FOUND ERROR IN FUNCTION USING INTO? ORA-01403

From: <sybrandb_at_hccnet.nl>
Date: Fri, 13 Jul 2007 19:24:56 +0200
Message-ID: <56df93183h763utqb51mu2oggvefmjan9b@4ax.com>


On Fri, 13 Jul 2007 10:04:15 -0700, jobs <jobs_at_webdos.com> wrote:

>I've got this simple select in my function
>
> select m.mcman_cdcli, into clientid
> from mcman m
> where m.mcman_cdani=v_ani;
>
>
>when no rows are found, I get ORA-01403 No Data found.
>
>Do I have to trap this? any way to just set to a default with NVL or
>something, Iv'e tried that and it did not work.

yes, you have to trap this.
Just put the select in it's own begin end block

begin

    select m.mcman_cdcli into clientid

     from mcman m
     where m.mcman_cdani=v_ani;

exception when no_data_found then -- equals ora-1403 clientid := NULL;
when others then
raise; -- reraise the exception
end;
--
 

    

Sybrand Bakker
Senior Oracle DBA
Received on Fri Jul 13 2007 - 12:24:56 CDT

Original text of this message

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