By kimot, 25 December, 2022 dcl-s CursorRows int(10) ; ... exec sql declare C1 INSENSITIVE cursor for .........; // INSENSITIVE if we want exact count of rows fetched into cursor ... exec sql open C1 ; exec sql GET DIAGNOSTICS :CursorRows = DB2_NUMBER_ROWS ;