ExecuteStoredProcedureEx()


" "

short ExecuteStoredProcedureEx(long QueryID, [VARIANT CommitOK], [VARIANT MaxResultSets],
 [VARIANT ColumnNames], [VARIANT ColumnLabels], [VARIANT ColumnComments])

Description

This function executes an SQL statement that uses the SQL verb CALL to run a stored procedure at the database server. Use ExecuteStoredProcedureEx() when the stored procedure returns results (instead of, or in addition to result sets). For stored procedures that do not return results, use ExecuteStoredProcedure().

To initialize a stored procedure for execution with ExecuteStoredProcedureEx(), call InitializeQuery or InitializeStaticQuery() and specify an SQL statement that uses the CALL statement. The stored procedure name should be specified as a literal in the CALL statement. Any parameters specified in the CALL statement (constant or otherwise) are ignored. Instead, use AddParameter(), AddDecimalParameter(), or SetParameter() to specify the input, output, and input-output parameters.

If the stored procedure returns result sets, call GetStoredProcedureResultSets() or MoreResultSets() to retrieve the query IDs for the result sets.

Parameters

Name Description
QueryID The ID of the query, as returned from InitializeQuery() or InitializeStaticQuery(). The SQL text for the query should specify a CALL statement. Specify a negative one (-1) if you want to return all the result sets the stored procedure returns. The default is negative one (-1).
CommitOK An optional Boolean value specifying whether the stored procedure can commit the unit of work or if this operation should be restricted. The default value is TRUE.
MaxResultSets An optional numeric value specifying the maximum number of result sets that the stored procedure should be allowed to return. Specify zero if you do not want the stored procedure to return any result sets or if the database server does not support returning result sets from stored procedures over DRDA.
ColumnNames An optional Boolean value specifying whether the database should return column names for the columns in each returned result set.
ColumnLabels An optional Boolean value specifying whether the database should return column labels for the columns in each returned result set.
ColumnComments An optional Boolean value specifying whether the database should return column comments for the columns in each returned result set.

Return Value

The return value will be zero if successful or non-zero if unsuccessful. If the return value is non-zero, you can call GetLastErrorString(), GetLastErrorType(), GetLastSQLCode(), GetLastSQLError(), or GetLastSQLState() to get additional error information.

Related Tasks

Execute()
ExecuteEx()
ExecuteStoredProcedure()
Open()