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: SQL Help

Re: SQL Help

From: Jeffery G. Wong <jgwong_at_us.oracle.com>
Date: Thu, 22 Apr 1999 21:50:32 -0700
Message-ID: <371FFC17.E1DA95CD@us.oracle.com>


Oracle will raise the no_data_found error if your select clause returns nothing. Here, you should raise an exception to trap the no_data_found error.

That is, in your EXCEPTION area of your PL/SQL procedure, do something like:

EXCEPTION
  when NO_DATA_FOUND then
    a_variable:=NULL;

Hope that helps.

Paul Davies wrote:

> When I have a select statement:
>
> select COL_A into a_variable from TABLE where TABLE.COL_B = value
>
> IF a_variable = null....
>
> within a PLSQL procedure, the procedure bombs out if no values are found.
> In Sybase, however, a_variable would be set to null. Is there a simple way
> I can force the select to behave like this in Oracle - ie it continues if no
> values are found and sets a_variable to null?
>
> Help appreciated
>
> Paul
Received on Thu Apr 22 1999 - 23:50:32 CDT

Original text of this message

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