Re: stupid newbbie question

From: David Lane <dlane_at_cix.compulink.co.uk>
Date: Tue, 8 Dec 1998 23:07:43 GMT
Message-ID: <F3o5Kv.88n_at_cix.compulink.co.uk>


In article <366DA824.3777493E_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!
>
>

The easiest way to do this is wrap the statement in a block: ....
BEGIN
    select ..... into ...... from table where ......; EXCEPTION
    when no_data_found then

        null;
END;
....

The count(*) should have worked too, but it means 2 queries where 1 would do.

Dave Lane (dlane_at_pt.lu) Received on Wed Dec 09 1998 - 00:07:43 CET

Original text of this message