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 > Cursor fetch stops fetching at 1000 records

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-19-06, 10:36
StarKat98 StarKat98 is offline
Registered User
 
Join Date: Oct 2006
Posts: 2
Question Cursor fetch stops fetching at 1000 records

Hi,
We are using a C program, with embedded SQL, to fetch records from a table in a DB2 database. After fetching 1000 records, we issue a commit. After this, the cursor stops fetching anything. Because of the way the code is written, I don't know what the error message is (it is installed in production), and I can't reproduce the problem in test. The cursor is declared as follows:

EXEC SQL DECLARE MyCursor CURSOR WITH HOLD FOR
SELECT
myfield1,
myfield2,
myfield3
FROM
mytable
ORDER BY
myfield1,
myfield2,
myfield3;

There are hundreds of thousands of records in the table. Why does the cursor presumably error out after fetching 1000 records? Here's my version info:
DB2 v8.1.6.912, Fixpack 6, DB2 Workgroup Server Edition
Windows 2003, service pack 1

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-19-06, 11:01
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The only things I can think of is that on your production system the "WITH HOLD" clause is not there. Either that or you are issuing a rollback at some point after the commit and before the next fetch.

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 10-19-06, 12:23
StarKat98 StarKat98 is offline
Registered User
 
Join Date: Oct 2006
Posts: 2
I've just checked the code, and the WITH HOLDS is in the production code, and there are no explicit rollbacks. I feel as though it could be a setting somewhere, since the code hasn't been changed in several years, and this problem just started occurring a couple of months ago. Unfortunately, I don't know what could have changed in the system to cause this. Thanks for your help!
If anyone else has seen this before, please let me know.

Last edited by StarKat98; 10-20-06 at 14:01.
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