From: "Sybrand Bakker" <postbus@sybrandb.demon.nl>
Subject: Re: cursors and sql%rowcount
Date: 2000/03/03
Message-ID: <952110615.24010.0.pluto.d4ee154e@news.demon.nl>#1/1
X-NNTP-Posting-Host: sybrandb.demon.nl:212.238.21.78
References: <89ovce$qbo$1@nnrp1.deja.com>
X-Trace: news.demon.nl 952110615 pluto:24010 NO-IDENT sybrandb.demon.nl:212.238.21.78
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Newsgroups: comp.databases.oracle.server
X-Complaints-To: abuse@nl.demon.net


Just read up on working with cursors.
Define an explicit cursor
Declare a variable as cursor%ROWTYPE;
Open cursor;
fetch cursor into <variable>;
close cursor;

That's all.
Sybrand Bakker, Oracle DBA

<kal121@my-deja.com> wrote in message news:89ovce$qbo$1@nnrp1.deja.com...
> Hi,
>
> I have a cursor that can return one or several hundred rows at a time.
>
> The thing is, I only ever want just the first row. Right now I'm
> executing the cursor in a FOR LOOP. Then, IF SQL%ROWCOUNT = 1, I get the
> values for the first row returned then halt executing of the loop with a
> RETURN statement.
>
> It's just that this seems a clunky way to do this. Is there any other
> way to limit the result set?
>
> The sql statement does not lend itself to limiting output,
> unfortunately. And I cannot use ROWID for this purpose, as the data
> retrieved by the cursor is not necessarily sequential.
>
> thanks
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




