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: Newbie Question...

Re: Newbie Question...

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 07 Nov 1998 21:07:29 GMT
Message-ID: <3648b63e.35421944@192.86.155.100>


A copy of this was sent to kdawson_at_chat.carleton.ca (Ken Dawson) (if that email address didn't require changing) On 7 Nov 1998 16:44:07 GMT, you wrote:

>
> Hi,
>
> is there a clean way to store the number of rows obtained from
> an SQL query into a variable?
>
> (ex.)
>
> EXEC SQL SELECT *
> INTO :foo
> FROM BAR
> WHERE <fooCondition>;
>
> no_rows = <some way to read the number of rows obtained
> from the query>.
>
>

for the above query, the answser is trivial -- its always one (select into returns at least one row, at most one row).

In general however, the variable sqlca.sqlerrd[2] in Pro*c (which is what it looks like you are using) stores the number of rows fetched by a cursor so far.

In pl/sql, it would be cursor_name%rowcount.  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Sat Nov 07 1998 - 15:07:29 CST

Original text of this message

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