Home » Developer & Programmer » Precompilers, OCI & OCCI » Query and Record Count with OCI Question.
Query and Record Count with OCI Question. [message #123492] Mon, 13 June 2005 13:48 Go to next message
TonyHoyt
Messages: 5
Registered: April 2005
Junior Member
Here's the basic issue. I open a cursor with OCI to query a large sum of records from the database, this takes some time to load all of them, so I want to throw up a message indicating that the process is still running, it's just taking a long time. So once I have the inital cursor open, is their a way to get back the record count without also calling a "Select count(*) from myTable" Before hand with OCI? Some kind of query information I can poll to know how many records came up with the query so I'll have a "Read 325 of 5000" display?

Tony
Re: Query and Record Count with OCI Question. [message #123775 is a reply to message #123492] Tue, 14 June 2005 15:51 Go to previous message
Michael Hartley
Messages: 110
Registered: December 2004
Location: West Yorkshire, United Ki...
Senior Member

Hi,

in short, there's no way to get an accurate figure for the number of rows in the table, unless you want to run a "select count(*)" first, but I wouldn't recommend that.

You could take a look at the user_tables view which will have the number of rows observed when the table was last analyzed, though if your dba is not routinely analyzing the database this will either be an old figure or null.

Alternatively if the query is taking more than 6 seconds to complete, excluding the time to drag the data over the network you could take a look at V$SESSION_LONGOPS, however this is a privileged user view so you may have trouble getting access to this in a production environment.

If the query takes less than 6 seconds to execute but you're spending most of your time waiting on the network, then you could just informat the user of the cummulative number of rows fetched an let their personal experience keep track of the max rows figure.

A technique more sympathetic to system resource consumption would be to have an animated icon on a small dialog box, something like the MS file copy icons.

If you really concerned about how long the user waits, why not present the first few rows to the user quickly, then gather the remainder of the rows in the background?

Kind regards,
Michael Hartley, http://www.openfieldsolutions.co.uk
Previous Topic: Oracle Cobol Precompiler (procob)
Next Topic: Tool for converting pro*c into form6i or report
Goto Forum:
  


Current Time: Fri Apr 19 10:37:51 CDT 2024