"How many rows are returned?" in OCI
Date: Wed, 14 Jul 1993 12:56:50 GMT
Message-ID: <1993Jul14.135650.1_at_vxcrna.cern.ch>
I'm using OCI and Oracle 7. My program does a query (of which it knows very little -- the query is obtained from the database) which will return an unknown number of rows. I have to pass the entire set of results as an array to another function call, and I'd like to avoid having to shuffle the data around.
Is there any way of determining after an oexec (but before the fetch(es)) the number of rows in the result?
I considered having the program analyze the queries and generate others which would return the rows (e.g., from a "select foo..." it'd generate "select count(foo)..."), but I didn't like it. Over the lifetime of the program, the queries will remain (mostly) static but will be repeated often, so I was planning on keeping each one in a cursor. Using a generated "count" query would either double the number of cursors or force me to keep reparsing the statements.
From the discussion of the ofen call ("Use ofen after oexfet to fetch additional rows, when you do not know in advance the exact number of rows that a query returns") it sounds like this is not provided for, but that doesn't mean it's impossible.
Thanks in advance for any ideas. I'll summarize e-mailed responses.
--
Frederick G. M. Roeber | CERN -- European Center for Nuclear Research
e-mail: roeber_at_cern.ch or roeber_at_caltech.edu | work: +41 22 767 31 80
r-mail: CERN/PPE, 1211 Geneva 23, Switzerland | home: +33 50 20 82 99
http://info.cern.ch/roeber/fgmr.html
Received on Wed Jul 14 1993 - 14:56:50 CEST
