Result sets from stored procedures in ODBC applications

In Db2 ODBC applications, you use open cursors to retrieve result sets from stored procedure calls.

Stored procedures that return result sets to Db2 ODBC open one or more cursors that are each associated with a query, and keep these cursors open when the stored procedure exits. When a stored procedure leaves more than one cursor open after it exits, it returns multiple result sets.

When you define a stored procedure that returns result sets, you must specify the maximum number of result sets that the procedure is to return. You specify this value in the DYNAMIC RESULT SETS clause in the CREATE PROCEDURE SQL statement. This value appears in the RESULT_SETS column of the SYSIBM.SYSROUTINES table for all stored procedures. A zero in this column indicates that open cursors return no result sets. Zero is the default value.