DB Access Module for ODBC User’s Guide : Chapter 2 Technical Information : Open SQL and ODBC : Stored Procedures and Open SQL
Stored Procedures and Open SQL
Standard ODBC CALL syntax can be used when executing stored procedures with RWDBOSql. Please see an ODBC API reference for additional information regarding the ODBC CALL syntax.
 
RWDBOSql myOpenSqlObject("{ CALL myStoredProc(?, ?) }", RWDBOSql::Procedure);
In this example, myStoredProc is the name of the stored procedure, and ? characters are the placeholders for the parameters to be passed to the stored procedure. Note the provided hint RWDBOSql::Procedure.
 
RWDBOSql myOpenSqlObject("{ ? = CALL myStoredProc(?, ?) }", RWDBOSql::Procedure);
This example uses an additional placeholder to receive the return value from the stored procedure as an OUT parameter.
Please see “An Open SQL Stored Procedure Example” for an example that uses RWDBOSql with stored procedures.
NOTE >> Stored procedure execution is not supported with the data callback classes.
Sequence of Fetching Result Sets and Out Parameters
Any restrictions on the sequence of fetching OUT parameters and result sets will be imposed by the underlying database ODBC driver. Some database drivers return the OUT parameters only after the result sets are returned. To be on the safe side, call fetchReturnParams() only after completely processing all the result sets.