Page 1 of 1

How to check sqlerrd(3) variable..

PostPosted: Thu Nov 19, 2009 4:19 pm
by snehal
Hi,

I want to check number of records fetched by cursor for particular where condition. I tried to check sqlerrd(3) variable after fetch command in code. But it was having value as zero.

Please let me know how to check number of records fetched by cursor.

Thanks.
Snehal.

Re: How to check sqlerrd(3) variable..

PostPosted: Fri Nov 20, 2009 1:03 am
by dick scherrer
Hello and welcome to the forum,

Did the cursor open work successfully?

Was the fetch sqlcode zero? If the sqlcode is 100, sqlerrd(3) will contain zero.

As an experiment, you might add 1 to some counter to see what is accumulated.

Re: How to check sqlerrd(3) variable..

PostPosted: Fri Nov 20, 2009 10:18 am
by snehal
Hello Dick,

Yes the cursor was opened successfully and sqlcode for fetch is zero. I fetched the record and was able to write it in output file.
My requirement is I am reading input file having return number and part number. Use this as where condition for cursor and fetch those many records from table that are found for this condition.


I will try counter as you suggest.

Thanks
Snehal

Re: How to check sqlerrd(3) variable..

PostPosted: Fri Nov 20, 2009 10:40 am
by dick scherrer
Good luck - it will be interesting to see what is happening :)

d

Re: How to check sqlerrd(3) variable..

PostPosted: Fri Nov 20, 2009 11:56 am
by jitender_2004bhiwani
Hi,

Sqlerrd(3) will not work on single row fetch since anyway the fecth statement fetches only one row. Incase of rowset fetch, it tells the number of rows to be fetched. I think in this case, you should try sqleerd(3) on open cursor and it will tell you the number of estimated rows.

Re: How to check sqlerrd(3) variable..

PostPosted: Tue Feb 16, 2010 4:10 pm
by venki3
Hi Snehal,
Could you post the answer when you tried the 'counter' option as suggested by Dick.

Thanks,
Venkateswari