Execute read-only SQL query
db_queryExecute read-only SQL queries on Oracle database with bind variables to prevent injection. Supports SELECT and WITH statements and enforces row limits.
Instructions
Execute a read-only SQL query against the Oracle database. Only SELECT and WITH (CTE) statements are allowed.
IMPORTANT: Always use Oracle bind variables (:1, :2, ...) instead of string interpolation to prevent SQL injection.
Example: sql: "SELECT * FROM users WHERE active = :1 AND created_at > :2" params: ["Y", "2024-01-01"]
Safety:
Only SELECT/WITH queries allowed (INSERT/UPDATE/DELETE/DROP blocked)
Automatic row limit (FETCH FIRST n ROWS ONLY)
Query timeout enforced
Maximum 500 rows returned
Args:
sql (string): Read-only SQL with :1, :2, ... bind variables
params (array): Values for bind variables (default: [])
max_rows (number): Max rows to return (default: 100, max: 500)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | A read-only SQL query. Must start with SELECT or WITH. Use Oracle bind variables :1, :2, ... for parameters. | |
| params | No | Parameter values for :1, :2, ... bind variables. ALWAYS use these instead of string interpolation to prevent SQL injection. | |
| max_rows | No | Maximum rows to return (default: 100). Results beyond this are truncated. |