Executar Consulta
AI-generatedOverview
This node allows executing SQL operations on an Oracle database. It supports running arbitrary SQL queries as well as performing common data manipulation tasks such as inserting, updating, and deleting rows in tables.
Typical use cases include:
- Running custom SELECT queries to retrieve data from Oracle databases.
- Inserting new records into tables programmatically.
- Updating existing records based on conditions.
- Deleting records matching specific criteria.
For example, you can use it to fetch customer data with a query like SELECT * FROM customers WHERE status = 'active', or insert a new order record by specifying the table and column values.
Properties
| Name | Meaning |
|---|---|
| Consulta (query) | The SQL query string to be executed. Used only when the operation is "Executar Consulta". |
| Opções Adicionais (options) | Collection of additional options: • Tamanho Máximo De Linhas: Maximum number of rows to return. • Converter Datas ISO: Whether to convert date fields to ISO string format. • Commit Automático: Whether to automatically commit changes after execution. |
Note: The properties above apply specifically to the "Executar Consulta" operation.
Output
The node outputs an array of items where each item contains a json property with the following structure depending on the operation:
For query operations (
executeQuery):rows: An array of objects representing each row returned by the query. Each object maps column names to their respective values.- If the "Converter Datas ISO" option is enabled, any Date objects in the rows are converted to ISO 8601 string format.
For insert, update, and delete operations:
rowsAffected: Number indicating how many rows were affected by the operation.
The output does not include binary data.
Dependencies
- Requires an Oracle database connection.
- Needs credentials providing user, password, host, port, and connection details.
- Uses the official OracleDB Node.js driver library for database communication.
- The node expects proper configuration of the Oracle connection string, which can be specified using different connection methods (e.g., TNS, SID, or service name).
- Requires appropriate permissions on the Oracle database to execute the specified SQL commands.
Troubleshooting
- Connection errors: Ensure that the Oracle database credentials and connection details are correct and that the database is reachable from the n8n environment.
- SQL syntax errors: Invalid SQL statements will cause execution failures. Verify the correctness of your SQL query or DML statements.
- Permission issues: Lack of sufficient privileges may result in errors when attempting inserts, updates, or deletes.
- Unsupported operations: Using an operation value other than the supported ones ("executeQuery", "insert", "update", "delete") will throw an error.
- Large result sets: If the query returns more rows than the configured maximum (
Tamanho Máximo De Linhas), results will be limited accordingly. - Date conversion: If dates are not appearing as expected, check the "Converter Datas ISO" option to control date formatting.