Re: SELECT INTO when there is no data.

From: A <kresimir.mikulic_at_globalnet.hr>
Date: Tue, 16 Mar 2004 11:44:39 +0100
Message-ID: <c36l9l$kc2$1_at_garrison.globalnet.hr>


declare

    forINTO varchar( 10 );
begin

    /* implicit cursor */
    select '1234567890' into forINTO from dual; exception

    when NO_DATA_FOUND then
    begin

        /* This executes when any select statment in program unit returns no value */

    end;
end;

"Martin Mølskov Hansen" <mmh_at_kab-bolig.dk> wrote in message news:4056b33b$0$229$edfadb0f_at_dread12.news.tele.dk...
> Try to split up your script and select one record at the time.
> In the end you will find which record(s) returns null.
>
> Or if this helps any thy this:
>
> Begin
> <Your entire statement>
> exception
> when others then
> NumOfRecords := 0;
> End;
>
> Regards
> Martin M. Hansen
>
> "moshe" <Moshe_t_at_yahoo.com> skrev i en meddelelse
> news:616be6f6.0403152300.65ecca17_at_posting.google.com...
> > Hi,
> >
> > I'm using the SELECT INTO syntax in my SP.
> > Sometimes, the SELECT returns no records, and the SP raise exception
> > for that reason.
> >
> > My solution : Firsly use SELECT COUNT(*) INTO NumOfRecords and then
> > check
> > the NumOfRecords, If it's greater/equal to 1 continue to the next
> > SELECT INTO.
> >
> > I believe that there's another better solution for that situation. Any
> > suggestion will be welcome.
> >
> > With thanks,
> > Moshe.
>
>
Received on Tue Mar 16 2004 - 11:44:39 CET

Original text of this message