SQL (DB2) row counts - TechRepublic
General discussion
January 25, 2001 at 03:25 PM
ds56748

SQL (DB2) row counts

by ds56748 . Updated 25 years, 1 month ago

I need to determine the number of rows returned from a DB2 v6.1 Query in a CICS pgm – with the following caveats:
1. use a CURSOR (DECLARE, OPEN, FETCH, etc.)
2. make one SQL call – minimize I/O
3. NO dynamic SQL
4. NO stored procedures

This would be a no brainer in any other DB (SQL Server, Oracle et al.) yet DB2 does not appear to support a special register like %COUNT% ouside of using stored procedures. The have a GET STATISTICS command in stored procedures that returns the rows affected by the previous SQL statement.

Anyone have any thoughts on how to accomplish this ?
TIA

This discussion is locked

All Comments