Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL cursor question

Re: PL/SQL cursor question

From: <the_very_at_my-dejanews.com>
Date: Wed, 08 Jul 1998 12:16:53 GMT
Message-ID: <6nvnvk$kn2$1@nnrp1.dejanews.com>


In article <1998070722430600.SAA06361_at_ladder01.news.aol.com>,   iancrozier_at_aol.com (Iancrozier) wrote:
> While running a PL/SQL program which uses a cursor, the program bombs at a
> certain select statement with the following message:
> no rows selected.
> Well, this is true for some of the data. The question is :
> How can I stop the program from bombing just because no rows are selected for
> this select statement.
> I would like to place a value in a variable when no rows are found, instead
> of having the program abort.
>
> TIA
>

Hi,

It can be done by putting the select in between BEGIN and END. Like

BEGIN main_procedure

BEGIN select column from table
where ....;

EXCEPTION
when no_data_found then variable := ......;

END; END main_procedure

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum Received on Wed Jul 08 1998 - 07:16:53 CDT

Original text of this message

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