×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
After I open an insensitive cursor, according to IBM documentation:
"SQLERRD(2) contains the actual number of rows in the result set." However,
this does not seem to be working for my SQL which has a CTE and a HAVING
clause. I simplified my example to make it as generic as possible:
**FREE
DCL-S NumRows INT(10);
EXEC SQL DECLARE TESTCSR INSENSITIVE CURSOR FOR
WITH IDs (ID) AS (
SELECT Identity FROM TABLET
)
SELECT ID
FROM IDs
GROUP BY ID
HAVING COUNT(*) > 1;
EXEC SQL OPEN TESTCSR;
NumRows = SQLERRD(2);
EXEC SQL CLOSE TESTCSR;
*INLR = *ON;
RETURN;
Assuming "Identity" is unique in TABLET, this SQL should always have 0
results and I would expect NumRows to get set to 0. However, it seems to be
getting set to the number of records in TABLET instead.
Is this a bug or is this an intended case where SQLERRD(2) is an estimate
instead of a real number of rows?
Thank you
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.