If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Get number of rows in result?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-27-03, 09:58
HabaHaba HabaHaba is offline
Registered User
 
Join Date: Oct 2003
Posts: 4
Get number of rows in result?

Hello, all!
I am writing a small application server for DB2(AS/400) on C/CLI.
Is there any way to get a number of rows in result after select but before the whole circle of fetch operations?
--
WBR, HabaHaba.
Reply With Quote
  #2 (permalink)  
Old 10-27-03, 13:43
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
If you mean the number of rows in a cursor, then I think you would have to submit two queries. First query (not in a cursor) that only selects count(*), but has same predicates. Second query would be the normal cursor that is fetched one row at a time.

The reason is that DB2 does not always know the entire number of rows in the cursor until you fetch them (unless cursor materialization is necessary to return the first row). In some cases, depending on the isolation level, the answer set could change between the first fetch and the last fetch.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On