Actions2
Overview
The "Execute Query" operation of the InterSystems IRIS n8n node allows users to run custom SQL queries against an InterSystems IRIS database. This is useful for retrieving, filtering, or aggregating data directly from the database using SQL syntax. Common scenarios include:
- Fetching records that match specific criteria (e.g., all products with low stock).
- Running complex joins or aggregations not easily achieved with other nodes.
- Integrating dynamic query parameters for flexible automation workflows.
Practical Example:
You could use this node to select all customers who made purchases over a certain amount in the last month, and then trigger follow-up actions based on those results.
Properties
| Name | Type | Meaning |
|---|---|---|
| Query | String | The SQL query to execute. Supports n8n expressions and positional parameters ($1, $2, etc.) for flexibility. |
| Query Parameters | String[] | List of values to substitute into the query's positional parameters ($1, $2, ...). |
Output
- The output is a JSON array where each item represents a row returned by the executed SQL query.
- Each object contains key-value pairs corresponding to the columns selected in the query.
- If multiple input items are processed, the output will contain results for each input item, maintaining their association.
Example Output:
[
{
"id": 123,
"name": "Product A",
"quantity": 50,
"price": 19.99
},
{
"id": 124,
"name": "Product B",
"quantity": 30,
"price": 29.99
}
]
Dependencies
- External Service: Requires access to an InterSystems IRIS database.
- Credentials: An n8n credential named
irismust be configured with valid connection details. - Environment: The node must be able to reach the IRIS database host/network.
Troubleshooting
Common Issues:
Invalid Credentials:
Error:Connection failedor similar messages.
Resolution: Double-check your IRIS credentials in n8n and ensure network connectivity.SQL Syntax Errors:
Error: Messages indicating invalid SQL syntax.
Resolution: Review your SQL query for typos or unsupported features.Parameter Mismatch:
Error: "Incorrect number of query parameters" or unexpected results.
Resolution: Ensure the number of items in "Query Parameters" matches the number of$1,$2, etc., placeholders in your query.Database Connection Issues:
Error: Timeouts or connection refused.
Resolution: Verify the database server is running and accessible from the n8n instance.
Links and References
- InterSystems IRIS Documentation
- n8n Expressions Guide
- n8n Database Nodes Documentation (for general SQL node usage patterns)