Execute SQL Query
execute_queryRun read-only SQL SELECT queries against IBM Db2i to fetch data safely, with row limits by default to prevent large result sets.
Instructions
Execute a read-only SQL SELECT query against the IBM Db2i database. Only SELECT statements are allowed for security. Results are limited by default to prevent large result sets.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL SELECT query to execute | |
| limit | No | Maximum number of rows to return (default: QUERY_DEFAULT_LIMIT, max: QUERY_MAX_LIMIT) | |
| params | No | Query parameters for prepared statement |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| cause | No | Why the statement failed. &1-style placeholders stand for values in error. | |
| error | No | ||
| sqlcode | No | SQLCODE of the failed statement, such as -204 | |
| success | Yes | ||
| recovery | No | What to change before trying again | |
| rowCount | No | ||
| sqlstate | No | SQLSTATE of the failed statement | |
| warnings | No | Tell the user these, such as columns the driver rounded | |
| truncated | No | True when the result stopped at limitApplied and more rows match | |
| violations | No | ||
| limitApplied | No | ||
| skippedFilters | No | Annotated tables whose row filter, such as leaving out deleted rows, the query does not use. See warnings |