Specification: | DB2 CLI 1.1 | ODBC 1.0 | ISO CLI |
SQLExecute() executes a statement, that is successfully prepared using SQLPrepare(), one or multiple times. The statement is executed using the current value of any application variables that were bound to parameter markers by SQLBindParameter().
Syntax
SQLRETURN SQLExecute (SQLHSTMT StatementHandle); /* hstmt */
Function arguments
Tabulka 46. SQLExecute arguments
Data type | Argument | Use | Description |
---|---|---|---|
SQLHSTMT | StatementHandle | input | Statement handle. |
Usage
The SQL statement string might contain parameter markers. A parameter marker is represented by a ? character, and is used to indicate a position in the statement where an application-supplied value is to be substituted when SQLExecute() is called. This value can be obtained from an application variable. SQLBindParameter() is used to bind the application storage area to the parameter marker.
All parameters must be bound before calling SQLExecute().
After the application processes the results from the SQLExecute() call, it can execute the statement again with new (or the same) parameter values.
A statement executed by SQLExecDirect() cannot be re-executed by calling SQLExecute(); SQLPrepare() must be called first.
If a result set is generated, SQLFetch() retrieves the next row of data into bound variables. Data can also be retrieved by calling SQLGetData() for any column that is not bound.
Return codes
SQL_NO_DATA_FOUND is returned if the SQL statement is a Searched UPDATE or Searched DELETE and no rows satisfy the search condition.
Diagnostics
The SQLSTATEs for SQLExecute() include all those for
SQLExecDirect() (refer to Tabulka 45), except for HY009 and HY090,
and also include the SQLSTATEs in Tabulka 47.
Tabulka 47. SQLExecute SQLSTATEs
SQLSTATE | Description | Explanation |
---|---|---|
HY010 | Function sequence error. | The specified StatementHandle is not in the prepared state. SQLExecute() is called without first calling SQLPrepare(). |
08004 | The application server rejected the connection. | The user name or password used to connect to the data source is not correct. |
08S01 | Communication link failure. | The communication link between the application and data source failed before the function completed. |
39001 | A user-defined function has returned an invalid SQLSTATE. | A user-defined function returned an SQLSTATE that is not valid. |
59101 | User not defined. | User is not defined in the Mobile Devices Administration Center control database. |
59102 | Incorrect password. | User password does not match the password defined in the Mobile Devices Administration Center. |
59103 | Group not defined. | Group is not defined in the Mobile Devices Administration Center. |
59104 | Application not defined. | Application is not defined in the Mobile Devices Administration Center. |
59105 | Subscription not defined. | Subscription with "AgentAdapter" is not defined in the Mobile Devices Administration Center. |
59106 | Subscription not complete. | The subscription does not have all the required information to invoke a remote stored procedure. |
59120 | XML conversion error. | AgentAdapter failed at converting user input data to XML document. |
59121 | General AgentAdapter error. | General AgentAdapter error. |
59122 | Loading library failed. | Some required libraries can not be found on the system. |
HY501 | Invalid DataSource name. | The specified data source name is not valid. |
Restrictions
None.
Související odkazy