Hallo,

hast Du eigentlich schon versucht die Anzahl Sätze über GET DIAGNOSTICS unmittelbar nach dem OPEN zu ermitteln?

PHP-Code:
EXEC SQL  GET DIAGNOSTICS :MyVar DB2_NUMBER_ROWS
Aber vermutlich führt dies zum gleichen Ergebnis wie SQLERR2.

SQL Reference:
DB2_NUMBER_ROWS
If the previous SQL statement was an OPEN or a FETCH which caused the size of the result table to be known, returns the number of rows in the result table. For SENSITIVE cursors, this value can be thought of as an approximation since rows inserted and deleted will affect the next retrieval of this value. If the previous statement was a PREPARE statement, returns the estimated number of rows in the result table for the prepared statement. Otherwise, the value zero is returned.
Birgitta