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: stupid newbie question

Re: stupid newbie question

From: David Lane <dlane_at_cix.compulink.co.uk>
Date: Wed, 9 Dec 1998 10:17:16 GMT
Message-ID: <F3p0Ks.CoK@cix.compulink.co.uk>


In article <366DA80C.9E166A8E_at_pca.state.mn.us>, kent.eilers_at_pca.state.mn.us (Kent Eilers) wrote:

> I writing some PL/SQL procedures and functions and have come up against
> a problem whenever a query returns no rows (ala the ORA-01403: no data
> found error message). I've looked in three books to get a strategy on
> dealing with this and have come up with zilch.
>
> Basically I do not want to go to an exception handler when this
> happens. I thought I had escaped this drainhole by first running a
> query to dump the count(*) into a local variable. But this still
> triggers the 1403 error.
>
> What do all you PL/SQL pro's do? My (rather limited) understanding of
> the exception handler is you cannot 'on error resume....' so how do deal
> with this?
>
> Any response greatly appreciated!
>
>

You just need to wrap up the statement:- ....
BEGIN
   select .... into .... from ..... where ....; EXCEPTION
    when no_data_found then

        null;
END;
....

(This assumes that you're only expecting 1 row!)

Your alternative method should work, but would mean 2 accesses where 1 would do.
Dave Lane (dlane_at_pt.lu) Received on Wed Dec 09 1998 - 04:17:16 CST

Original text of this message

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