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: Select into problem

Re: Select into problem

From: Jaap W. van Dijk <j.w.vandijk.removethis_at_hetnet.nl>
Date: Wed, 13 Dec 2006 15:53:07 GMT
Message-ID: <45802169.552421@news.hetnet.nl>


On 12 Dec 2006 13:32:50 -0800, "Jun" <frankjunli_at_gmail.com> wrote:

>Hi Guys,
>
> I have a question about PL/SQL code
>
> I have the following select into statement :
>
> SELECT STUD_AGE INTO v_cHP_MaxAge FROM STUDENT WHERE GDU =
>'015346001002';
>
> I know It has no value returned but it give a no_data_found error.
> How do I escape that error without using exception?
> Is there any way to force the query return some value instead of an
>error?
>
>Thanks in advance
>

select (select STUD_AGE FROM STUDENT WHERE GDU = '015346001002') INTO v_cHP_MaxAge
FROM DUAL; This will be null if the inner select returns no records and throw an error when it returns more than one.

Regards, Jaap. Received on Wed Dec 13 2006 - 09:53:07 CST

Original text of this message

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