Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 240 additions & 0 deletions docs/integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
---
title: Oracle Database node documentation
description: Learn how to use the Oracle Database node in n8n. Follow technical documentation to integrate Oracle Database node into your workflows.
contentType: [integration, reference]
priority: critical
---

# Oracle Database node

Use the Oracle Database node to automate work in Oracle Database, and integrate Oracle Database with other applications. n8n has built-in support for a wide range of Oracle Database features, including executing an SQL query, as well as inserting, and updating rows in a database.

On this page, you'll find a list of operations the Oracle Database node supports and links to more resources.

/// note | Credentials
Refer to [Oracle Database credentials](/integrations/builtin/credentials/oracledb.md) for guidance on setting up authentication.
///

--8<-- "/_snippets/integrations/builtin/app-nodes/ai-tools.md"

## Operations

* [**Delete**](#delete): Delete an entire table or rows in a table
* [**Execute SQL**](#execute-sql): Execute an SQL statement
* [**Insert**](#insert): Insert rows in a table
* [**Insert or Update**](#insert-or-update): Insert or update rows in a table
* [**Select**](#select): Select rows from a table
* [**Update**](#update): Update rows in a table

### Delete

Use this operation to delete an entire table or rows in a table.

Enter these parameters:

- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md).
- **Operation**: Select **Delete**.
- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name.
- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list or **By Name** to enter the table name.
- **Command**: The deletion action to take:
- **Truncate**: Removes the table's data but preserves the table's structure.
- **Delete**: Delete the rows that match the "Select Rows" condition. If you don't select anything, Oracle Database deletes all rows.
- **Select Rows**: Define a **Column**, **Operator**, and **Value** to match rows on. The value
can be passed as JSON using expression or string.
- **Combine Conditions**: How to combine the conditions in "Select Rows". **AND** requires all conditions to be true, while **OR** requires at least one condition to be true.
- **Drop**: Deletes the table's data and structure permanently.

#### Delete options

- **Auto Commit**: Whether this property is true, then the transaction in the current connection is automatically committed at the end of statement execution.
- **Statement Batching**: The way to send queries to the database:
- **Single Statement**: A single Statement for all incoming items.
- **Independently**: Execute one Statement per incoming item of the execution.
- **Transaction**: Execute all Statements in a transaction. If a failure occurs, Oracle Database rolls back all changes.

### Execute SQL

Use this operation to execute an SQL statement.

Enter these parameters:

- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md).
- **Operation**: Execute SQL **Execute SQL**.
- **Statement**: The SQL statement to execute. You can use n8n [expressions](/code/expressions.md) and positional parameters like `:1`, `:2`, or named parameters like `:name`, `:id` to use with [Use bind parameters](#use-bind-parameters).

#### Execute Statement options

- **Auto Commit**: Whether this property is true, then the transaction in the current connection is automatically committed at the end of statement execution.
- **Bind Variable Placeholder Values**: Enter the values for the bind parameters used in the statement [Use bind parameters](#use-bind-parameters).
- **Output Numbers As String**: Whether the numbers should be retrieved as string.
- **Fetch Array Size**: This property is a number that sets the size of an internal buffer used for fetching query rows from Oracle Database. Changing it may affect query performance but does not affect how many rows are returned to the application.
- **Number of Rows to Prefetch**: This property is a query tuning option to set the number of additional rows the underlying Oracle driver fetches during the internal initial statement execution phase of a query.

### Insert

Use this operation to insert rows in a table.

Enter these parameters:

- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md).
- **Operation**: Select **Insert**.
- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name.
- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list or **By Name** to enter the table name.
- **Mapping Column Mode**: How to map column names to incoming data:
- **Map Each Column Manually**: Select the values to use for each column [Use n8n expressions for bind values](#use-n8n-expressions-for-bind-values).
- **Map Automatically**: Automatically map incoming data to matching column names in Oracle Database. The incoming data field names must match the column names in Oracle Database for this to work. If necessary, consider using the [edit fields (set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) before this node to adjust the format as needed.

#### Insert options

- **Auto Commit**: Whether this property is true, then the transaction in the current connection is automatically committed at the end of statement execution.
- **Output Columns**: Choose which columns to output. You can select from a list of available columns or specify IDs using [expressions](/code/expressions.md).
- **Statement Batching**: The way to send queries to the database:
- **Single Statement**: A single Statement for all incoming items.
- **Independently**: Execute one Statement per incoming item of the execution.
- **Transaction**: Execute all Statements in a transaction. If a failure occurs, Oracle Database rolls back all changes.

### Insert or Update

Use this operation to insert or update rows in a table.

Enter these parameters:

- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md).
- **Operation**: Select **Insert or Update**.
- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name.
- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list or **By Name** to enter the table name.
- **Mapping Column Mode**: How to map column names to incoming data:
- **Map Each Column Manually**: Select the values to use for each column [Use n8n expressions for bind values](#use-n8n-expressions-for-bind-values).
- **Map Automatically**: Automatically map incoming data to matching column names in Oracle Database. The incoming data field names must match the column names in Oracle Database for this to work. If necessary, consider using the [edit fields (set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) before this node to adjust the format as needed.

#### Insert or Update options

- **Auto Commit**: Whether this property is true, then the transaction in the current connection is automatically committed at the end of statement execution.
- **Output Columns**: Choose which columns to output. You can select from a list of available columns or specify IDs using [expressions](/code/expressions.md).
- **Statement Batching**: The way to send queries to the database:
- **Single Statement**: A single Statement for all incoming items.
- **Independently**: Execute one Statement per incoming item of the execution.
- **Transaction**: Execute all Statements in a transaction. If a failure occurs, Oracle Database rolls back all changes.

### Select

Use this operation to select rows in a table.

Enter these parameters:

- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md).
- **Operation**: Select **Select**.
- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name.
- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list or **By Name** to enter the table name.
- **Return All**: Whether to return all results or only up to a given limit.
- **Limit**: The maximum number of items to return when **Return All** is disabled.
- **Select Rows**: Set the conditions to select rows. Define a **Column**, **Operator**, and **Value**(as `json`) to match rows on. If you don't select anything, Oracle Database selects all rows.
- **Combine Conditions**: How to combine the conditions in **Select Rows**. **AND** requires all conditions to be true, while **OR** requires at least one condition to be true.
- **Sort**: Choose how to sort the selected rows. Choose a **Column** from a list or by ID and a sort **Direction**.

#### Select options

- **Auto Commit**: Whether this property is true, then the transaction in the current connection is automatically committed at the end of statement execution.
- **Output Numbers As String**: Whether the numbers should be retrieved as string.
- **Fetch Array Size**: This property is a number that sets the size of an internal buffer used for fetching query rows from Oracle Database. Changing it may affect query performance but does not affect how many rows are returned to the application.
- **Number of Rows to Prefetch**: This property is a query tuning option to set the number of additional rows the underlying Oracle driver fetches during the internal initial statement execution phase of a query.

### Update

Use this operation to update rows in a table.

Enter these parameters:

- **Credential to connect with**: Create or select an existing [Oracle Database credential](/integrations/builtin/credentials/oracledb.md).
- **Operation**: Select **Update**.
- **Schema**: Choose the schema that contains the table you want to work on. Select **From list** to choose the schema from the dropdown list or **By Name** to enter the schema name.
- **Table**: Choose the table that you want to work on. Select **From list** to choose the table from the dropdown list or **By Name** to enter the table name.
- **Mapping Column Mode**: How to map column names to incoming data:
- **Map Each Column Manually**: Select the values to use for each column [Use n8n expressions for bind values](#use-n8n-expressions-for-bind-values).
- **Map Automatically**: Automatically map incoming data to matching column names in Oracle Database. The incoming data field names must match the column names in Oracle Database for this to work. If necessary, consider using the [edit fields (set) node](/integrations/builtin/core-nodes/n8n-nodes-base.set.md) before this node to adjust the format as needed.

#### Update options

- **Auto Commit**: Whether this property is true, then the transaction in the current connection is automatically committed at the end of statement execution.
- **Output Columns**: Choose which columns to output. You can select from a list of available columns or specify IDs using [expressions](/code/expressions.md).
- **Statement Batching**: The way to send queries to the database:
- **Single Statement**: A single Statement for all incoming items.
- **Independently**: Execute one Statement per incoming item of the execution.
- **Transaction**: Execute all Statements in a transaction. If a failure occurs, Oracle Database rolls back all changes.

## Templates and examples

<!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
[[ templatesWidget(page.title, 'oracledb') ]]

## Related resources

Refer to [SQL Language Reference](https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/index.html) for more information about the service.

## Use bind parameters

When creating a query to run on a Oracle database, you can use the **Bind Variable Placeholder Values** field in the **Options** section to load data into the query. n8n sanitizes data in query parameters, which prevents SQL injection.

For example, you want to find a specific fruits by their color. Given the following input data:

```js
[
{
"FRUIT_ID": 1,
"FRUIT_NAME": "Apple",
"COLOR": "Red"
},
{
"FRUIT_ID": 2,
"FRUIT_NAME": "Banana",
"COLOR": "Yellow"
}
]
```

You can write a query like:

```sql
SELECT * FROM FRUITS WHERE COLOR = :col
```

Then in **Bind Variable Placeholder Values**, provide the field values to use. You can provide fixed values or expressions. For this example, use expressions so the node can pull the color from each input item in turn:

```js
// fruits is an example table name
fruits, {{ $json.color }}
```

## Use n8n Expressions for bind values

For **Values to Send**, you can provide inputs using n8n Expressions. Below are examples for different data types — you can either enter constant values or reference fields from previous items (`$json`):

### JSON
- Constant: `{{ { k1: "v1", k2: "v2" } }}`
- From a previous item: `{{ $json.COL_JSON }}`

### VECTOR
- Constant: `{{ [1, 2, 3, 4.5] }}`
- From a previous item: `{{ $json.COL_VECTOR }}`

### BLOB
- Constant: `{{ [94, 87, 34] }}` or `{{ ' BLOB data string' }}`
- From a previous item: `{{ $json.COL_BLOB }}`

### RAW
- Constant: `{{ [94, 87, 34] }}`
- From a previous item: `{{ $json.COL_RAW }}`

### BOOLEAN
- Constant: `{{ true }}`
- From a previous item: `{{ $json.COL_BOOLEAN }}`

### NUMBER
- Constant: `1234`
- From a previous item: `{{ $json.COL_NUMBER }}`

## VARCHAR
- Constant: `' Hello World '`
- From a previous item: `{{ $json.COL_CHAR }}`

These examples assume JSON keys (e.g. `COL_JSON, COL_VECTOR`) map directly to the respective SQL column types.
79 changes: 79 additions & 0 deletions docs/integrations/builtin/credentials/oracledb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: Oracle Database credentials
description: Documentation for Oracle Database credentials. Use these credentials to authenticate Oracle Database in n8n, a workflow automation platform.
contentType: [integration, reference]
priority: high
---

# Oracle Database credentials

You can use these credentials to authenticate the following nodes:

- [OracleDB](/integrations/builtin/app-nodes/n8n-nodes-base.oracledb/index.md)
- [Agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/index.md)

/// note
These nodes do not support SSH tunnels.
///

## Prerequisites

Create a user account on a [OracleDB](https://docs.oracle.com/en/database/oracle/oracle-database/23/sqlrf/CREATE-USER.html) server database.

## Supported authentication methods

- Database connection

## Related resources

Refer to [OracleDB's documentation](https://docs.oracle.com/en/database/oracle/oracle-database) for more information about the service.

## Using database connection

To configure this credential, you'll need:

- A **User** name.
- A **Password** for that user.
- **Connection String**: The Oracle database instance to connect to. The string can be an Easy Connect string, or a Net Service Name from a tnsnames.ora file, or the name of a local Oracle database instance.
- **Use Optional Oracle Client Libraries**: If you want to use node-oracledb Thick mode, turn this on. This option will not be available in official n8n docker images. Additional settings to enable thick mode are required. Refer to [Enabling Thick mode documentation](https://node-oracledb.readthedocs.io/en/latest/user_guide/initialization.html#enabling-node-oracledb-thick-mode) for more information.
- **Use SSL**: If your Connection String is using SSL, turn this on and configure additional details for the SSL Authentication.
- **Wallet Password**: The password to decrypt the Privacy Enhanced Mail (PEM)-encoded private certificate, if it is encrypted.
- **Wallet Content**: The security credentials required to establish a mutual TLS (mTLS) connection to Oracle Database.
- **Distinguished Name**: The distinguished name (DN) that should be matched with the certificate DN.
- **Match Distinguished Name**: Whether the server certificate DN should be matched in addition to the regular certificate verification that is performed.
- **Allow Weak Distinguished Name Match**: Whether the secure DN matching behavior which checks both the listener and server certificates has to be performed.
- **Pool Min**: The number of connections established to the database when a pool is created.
- **Pool Max**: The maximum number of connections to which a connection pool can grow.
- **Pool Increment**: The number of connections that are opened whenever a connection request exceeds the number of currently open connections.
- **Pool Maximum Session Life Time**: The number of connections that are opened whenever a connection request exceeds the number of currently open connections.
- **Pool Connection Idle Timeout**: The number of connections that are opened whenever a connection request exceeds the number of currently open connections.
- **Connection Class Name**: DRCP/PRCP Connection Class.
- **Connection Timeout**: The timeout duration in seconds for an application to establish an Oracle Net connection.
- **Transport Connection Timeout**: The maximum number of seconds to wait to establish a connection to the database host.
- **Keepalive Probe Interval**: The number of minutes between the sending of keepalive probes.


To set up your database connection credential:

1. Enter your database's username as the **User** in your n8n credential. Run this query to confirm the username:

```
SELECT SYS_CONTEXT('USERENV', 'SESSION_USER') AS session_user FROM dual;
```

2. Enter your database's connection string as the **Connection String** in your n8n credential. Run this query to confirm the database name:

```
SELECT SYS_CONTEXT('USERENV', 'CON_NAME') AS current_pdb FROM dual;
```

3. If your database uses SSL and you'd like to use **SSL** for the connection, turn this option on in the credential. If you turn it on, enter the information of your OracleDB SSL certificate in these fields:
1. Enter the output of PEM-encoded wallet file, **ewallet.pem** contents after retaining the new lines. The command

```bash
node -e "console.log('{{\"' + require('fs').readFileSync('ewallet.pem', 'utf8').split('\n').join('\\\\n') + '\"}}')"
```

can be used to dump file contents in the **Wallet Content** field.

Refer to [Node OracleDB ](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#mutual-tls-connections-to-oracle-cloud-autonomous-database) for more information on working with TLS connections.
Loading