Validate SQL Query
validate_queryCheck SQL statements without executing them by parsing references and confirming tables, columns, and routines exist, while reporting read-only and schema-allowlist issues.
Instructions
Check a SQL statement without running it. Parses it with QSYS2.PARSE_STATEMENT and checks that referenced tables, columns, and qualified routines exist in the catalog. Also reports read-only and schema-allowlist findings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL statement to validate. It is not executed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cause | No | Why the statement failed. &1-style placeholders stand for values in error. | |
| error | No | ||
| valid | No | ||
| sqlcode | No | SQLCODE of the failed statement, such as -204 | |
| success | Yes | ||
| recovery | No | What to change before trying again | |
| sqlstate | No | SQLSTATE of the failed statement | |
| warnings | No | ||
| violations | No | ||
| missingTables | No | ||
| statementType | No | ||
| missingColumns | No | ||
| skippedFilters | No | Annotated tables whose row filter, such as leaving out deleted rows, the query does not use. See warnings | |
| missingRoutines | No |