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: PL/SQL Newbie Question

Re: PL/SQL Newbie Question

From: Gene Hubert <ghubert_at_netpath.net>
Date: Sat, 11 Sep 1999 02:44:11 GMT
Message-ID: <4ED7A2577E9EE37B.BDFD545A8C173205.39D4034BB95C7333@lp.airnews.net>


Don't forget that setting MyVariable to ' ' is the same as setting it to null.

Gene Hubert
SkillsPoint.com


On Sat, 11 Sep 1999 01:47:36 +0100, Paul Scott <aspscott_at_tcp.co.uk> wrote:

>On Fri, 10 Sep 1999 23:33:47 GMT, khs_at_netset.com wrote:
>
>>I have a SELECT statement that returns, at most, 1 row in a procedure.
>>When the select doesn't return a row (NO_DATA_FOUND) I want to set the
>>variable that recieves the column value to a space (' ') and go on
>>with the rest of the logic in the procedure. What happens is that the
>>procedure exits. How can I prevent this?
>>
>>Thanks for your help...
>
>You have to trap the NO_DATA_FOUND exception in an exception handler.
>Once safely trapped, your code can continue without exiting.
>
>Here's an example for you :
>
>procedure MyProc(MyParameter in integer, AnOutput out integer)
>is
> MyVariable Char(1);
>begin
> begin
> select
> MY_CHAR_FIELD
> into
> MyVariable
> from
> MY_TABLE
> where
> MY_PRIMARY_KEY = MyParameter;
> exception
> when NO_DATA_FOUND then
> MyVariable := ' ';
> end;
> /* Do some more code in here to do with your output parameter */
>end;
>
>Hope this helps.
>
>Paul Scott
Received on Fri Sep 10 1999 - 21:44:11 CDT

Original text of this message

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