PHP can handle multiple result sets from a DB2 SQL Stored Procedures on IBM i

Did you know that a DB2 SQL stored procedure can pull back multiple result sets?  Its as simple as adding this to your Create Procedure statement:  DYNAMIC RESULT SETS 2.  You can use any integer value but I used 2.

To access the additional result sets in PHP you can use either odbc_next_result or db2_next_result.  The main advantage of pulling back multiple result sets is that you only have to issue 1 call to a stored procedure to pull back all the information that you may need.

http://php.net/manual/en/function.odbc-next-result.php

http://php.net/manual/en/function.db2-next-result.php

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s