Skip to content

Oracle 数据库节点#

¥Oracle Database node

使用 Oracle Database 节点可自动执行 Oracle Database 中的操作,并将 Oracle Database 与其他应用集成。n8n 内置支持多种 Oracle 数据库功能,包括执行 SQL 语句、从 Oracle 数据库获取、插入、更新或删除数据。此节点内部使用 node-oracledb 驱动程序

¥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 which includes executing an SQL statement, fetching, inserting, updating or deleting data from Oracle Database. This node uses the node-oracledb driver internally.

本页列出了 Oracle Database 节点支持的操作列表以及更多资源的链接。

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

Note

请参阅 Oracle 数据库凭据 以了解有关设置身份验证的指导。

¥Refer to Oracle Database credentials for guidance on setting up authentication.

需要 Oracle 数据库 19c 或更高版本。对于透明应用连续性 (TAC) 和分片等高级 Oracle 数据库功能,还需要 Oracle 客户端库 19c 或更高版本。

¥Requires Oracle Database 19c or later. For advanced Oracle Database features like Transparent Application Continuity (TAC) and Sharding, also requires Oracle Client Libraries 19c or later.

操作#

¥Operations

  • 删除:删除整个表或表中的行。

¥Delete: Delete an entire table or rows in a table

¥Execute SQL: Execute an SQL statement

¥Insert: Insert rows in a table

¥Insert or Update: Insert or update rows in a table

  • 选择:从表格中选择行

¥Select: Select rows from a table

  • 更新:更新表格中的行

¥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.

  • 操作:选择“删除”。

¥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 select 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.

  • 删除:删除符合 "选择“行”。" 条件的行。如果你未选择任何内容,Oracle 数据库将删除所有行。

    ¥Delete: Delete the rows that match the "Select Rows" condition. If you don't select anything, Oracle Database deletes all rows.

    • 选择“行”:定义用于匹配行的列、运算符和值。可以使用表达式或字符串以 JSON 格式传递该值。

    ¥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". The 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

  • 自动提交:当此属性设置为 true 时,当前连接中的事务会在语句执行完毕后自动提交。

¥Auto Commit: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution.

  • 语句批处理:向数据库发送语句的方式:

¥Statement Batching: The way to send statements to the database:

  • 单语句:针对所有传入项的单个语句。

    ¥Single Statement: A single statement for all incoming items.

  • 独立:对执行的每个传入项执行一条语句。

    ¥Independently: Execute one statement per incoming item of the execution.

  • 事务:执行事务中的所有语句。如果发生故障,Oracle 数据库会回滚所有更改。

    ¥Transaction: Execute all statements in a transaction. If a failure occurs, Oracle Database rolls back all changes.

执行 SQL#

¥Execute SQL

使用此操作执行 SQL 语句。

¥Use this operation to execute an SQL statement.

请输入以下参数:

¥Enter these parameters:

¥Credential to connect with: Create or select an existing Oracle Database credential.

  • 操作:执行 SQL 语句。

¥Operation: Execute SQL Execute SQL.

  • 语句:要执行的 SQL 语句。你可以使用 n8n expressions 和位置参数(例如 :1:2)或命名参数(例如 :name:id)来配合 使用绑定参数 使用。要运行 PL/SQL 过程(例如 demo),你可以使用:

¥Statement: The SQL statement to execute. You can use n8n expressions and positional parameters like :1, :2, or named parameters like :name, :id to use with Use bind parameters. To run a PL/SQL procedure, for example demo, you can use:

1
2
3
BEGIN
  demo;
END;

执行语句选项#

¥Execute Statement options

  • 自动提交:当此属性设置为 true 时,当前连接中的事务会在语句执行完毕后自动提交。

¥Auto Commit: When this property is set to true, 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.

  • 输出数字(字符串):指示是否应将数字作为字符串检索。

¥Output Numbers As String: Indicates if the numbers should be retrieved as a String.

  • 获取数组大小:此属性是一个数值,用于设置从 Oracle 数据库获取查询行的内部缓冲区的大小。更改此项可能会影响查询性能,但不会影响返回给应用的行数。

¥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.

  • 要预取的行数:此属性是一个查询调优选项,用于设置底层 Oracle 驱动程序在查询的内部初始语句执行阶段获取的额外行数。

¥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.

  • 操作:选择“插入”。

¥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 select By Name to enter the table name.

  • 映射列模式:如何将列名映射到传入数据?

¥Mapping Column Mode: How to map column names to incoming data:

  • 手动映射每一列:选择每列 使用 n8n 表达式绑定值 的值。

    ¥Map Each Column Manually: Select the values to use for each column Use n8n expressions for bind values.

  • 自动映射:自动将传入数据映射到 Oracle 数据库中匹配的列名。为确保此功能正常工作,传入的数据字段名称必须与 Oracle 数据库中的列名称匹配。如有必要,请考虑在此节点前使用 编辑字段(设置)节点 来根据需要调整格式。

    ¥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 before this node to adjust the format as needed.

插入选项#

¥Insert options

  • 自动提交:当此属性设置为 true 时,当前连接中的事务会在语句执行完毕后自动提交。

¥Auto Commit: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution.

  • 输出列:选择要输出的列。你可以从可用列列表中选择,也可以使用 expressions 指定 ID。

¥Output Columns: Choose which columns to output. You can select from a list of available columns or specify IDs using expressions.

  • 语句批处理:向数据库发送语句的方式:

¥Statement Batching: The way to send statements to the database:

  • 单语句:针对所有传入项的单个语句。

    ¥Single Statement: A single statement for all incoming items.

  • 独立:对执行的每个传入项执行一条语句。

    ¥Independently: Execute one statement per incoming item of the execution.

  • 事务:执行事务中的所有语句。如果发生故障,Oracle 数据库会回滚所有更改。

    ¥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.

  • 操作:选择“插入”或“更新”。

¥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 select By Name to enter the table name.

  • 映射列模式:如何将列名映射到传入数据?

¥Mapping Column Mode: How to map column names to incoming data:

  • 手动映射每一列:选择每列 使用 n8n 表达式绑定值 的值。

    ¥Map Each Column Manually: Select the values to use for each column Use n8n expressions for bind values.

  • 自动映射:自动将传入数据映射到 Oracle 数据库中匹配的列名。为确保此功能正常工作,传入的数据字段名称必须与 Oracle 数据库中的列名称匹配。如有必要,请考虑在此节点前使用 编辑字段(设置)节点 来根据需要调整格式。

    ¥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 before this node to adjust the format as needed.

插入或更新选项#

¥Insert or Update options

  • 自动提交:当此属性设置为 true 时,当前连接中的事务会在语句执行完毕后自动提交。

¥Auto Commit: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution.

  • 输出列:选择要输出的列。你可以从可用列列表中选择,也可以使用 expressions 指定 ID。

¥Output Columns: Choose which columns to output. You can select from a list of available columns or specify IDs using expressions.

  • 语句批处理:向数据库发送语句的方式:

¥Statement Batching: The way to send statements to the database:

  • 单语句:针对所有传入项的单个语句。

    ¥Single Statement: A single statement for all incoming items.

  • 独立:对执行的每个传入项执行一条语句。

    ¥Independently: Execute one statement per incoming item of the execution.

  • 事务:执行事务中的所有语句。如果发生故障,Oracle 数据库会回滚所有更改。

    ¥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.

  • 操作:选择“选择”。

¥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 select 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.

  • 选择“行”:设置选择行的条件。定义用于匹配行的列、运算符和值(为 json)。该值可能因类型而异,例如在固定模式下:

¥Select Rows: Set the conditions to select rows. Define a Column, Operator, and Value(as json) to match rows on. The Value can vary by type — for example with Fixed mode:

  • 字符串:"hello",hellowithoutquotes,"带空格的 hello"

    ¥String: "hello", hellowithoutquotes, "hello with space"

  • 数字:12

    ¥Number: 12

  • JSON:{ "key": "val" }

如果你未选择任何内容,Oracle 数据库将选择所有行。

¥If you don't select anything, Oracle Database selects all rows.

  • 合并条件:如何在“选择行”中组合条件?“与”逻辑需要所有条件都为真,而“或”逻辑至少需要一个条件为真。

¥Combine Conditions: How to combine the conditions in Select Rows. The AND requires all conditions to be true, while OR requires at least one condition to be true.

  • 排序:选择如何对选定的行进行排序。从列表中或按 ID 选择列,并设置排序方向。

¥Sort: Choose how to sort the selected rows. Choose a Column from a list or by ID and a sort Direction.

选择选项#

¥Select options

  • 自动提交:当此属性设置为 true 时,当前连接中的事务会在语句执行完毕后自动提交。

¥Auto Commit: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution.

  • 输出数字(字符串):指示是否应将数字作为字符串检索。

¥Output Numbers As String: Indicates if the numbers should be retrieved as a String.

  • 获取数组大小:此属性是一个数值,用于设置从 Oracle 数据库获取查询行的内部缓冲区的大小。更改此项可能会影响查询性能,但不会影响返回给应用的行数。

¥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.

  • 要预取的行数:此属性是一个查询调优选项,用于设置底层 Oracle 驱动程序在查询的内部初始语句执行阶段获取的额外行数。

¥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.

  • 操作:选择“更新”。

¥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 select By Name to enter the table name.

  • 映射列模式:如何将列名映射到传入数据?

¥Mapping Column Mode: How to map column names to incoming data:

  • 手动映射每一列:选择每列 使用 n8n 表达式绑定值 的值。

    ¥Map Each Column Manually: Select the values to use for each column Use n8n expressions for bind values.

  • 自动映射:自动将传入数据映射到 Oracle 数据库中匹配的列名。为确保此功能正常工作,传入的数据字段名称必须与 Oracle 数据库中的列名称匹配。如有必要,请考虑在此节点前使用 编辑字段(设置)节点 来根据需要调整格式。

    ¥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 before this node to adjust the format as needed.

更新选项#

¥Update options

  • 自动提交:当此属性设置为 true 时,当前连接中的事务会在语句执行完毕后自动提交。

¥Auto Commit: When this property is set to true, the transaction in the current connection is automatically committed at the end of statement execution.

  • 输出列:选择要输出的列。你可以从可用列列表中选择,也可以使用 expressions 指定 ID。

¥Output Columns: Choose which columns to output. You can select from a list of available columns or specify IDs using expressions.

  • 语句批处理:向数据库发送语句的方式:

¥Statement Batching: The way to send statements to the database:

  • 单语句:针对所有传入项的单个语句。

    ¥Single Statement: A single statement for all incoming items.

  • 独立:对执行的每个传入项执行一条语句。

    ¥Independently: Execute one statement per incoming item of the execution.

  • 事务:执行事务中的所有语句。如果发生故障,Oracle 数据库会回滚所有更改。

    ¥Transaction: Execute all statements in a transaction. If a failure occurs, Oracle Database rolls back all changes.

相关资源#

¥Related resources

有关服务的更多信息,请参阅 SQL 语言参考

¥Refer to SQL Language Reference for more information about the service.

有关 node-oracledb 驱动程序的更多信息,请参阅 node-oracledb 文档

¥Refer to node-oracledb documentation for more information about the node-oracledb driver.

使用绑定参数#

¥Use bind parameters

创建要在 Oracle 数据库实例上运行的语句时,你可以使用“选项”部分中的“绑定变量占位符值”字段将数据加载到语句中。n8n 对语句参数中的数据进行清理,以防止 SQL 注入。

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

例如,你想要根据颜色查找特定水果。给定以下输入数据:

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[
    {
        "FRUIT_ID": 1,
        "FRUIT_NAME": "Apple",
        "COLOR": "Red" 
    },
    {
        "FRUIT_ID": 2,
        "FRUIT_NAME": "Banana",
        "COLOR": "Yellow"
    }
]

你可以编写如下语句:

¥You can write a statement like:

1
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:

1
2
// fruits is an example table name
fruits, {{ $json.color }} 

使用 n8n 表达式作为绑定值#

¥Use n8n Expressions for bind values

对于要发送的值,你可以使用 n8n 表达式提供输入。以下是不同数据类型的示例 - 你可以输入常量值,也可以引用之前项目中的字段($json):

¥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#

  • 常量:{{ { k1: "v1", k2: "v2" }}}

¥Constant: {{ { k1: "v1", k2: "v2" }}}

  • 从上一个项目获取:{{ $json.COL_JSON }}

¥From a previous item: {{ $json.COL_JSON }}

VECTOR#

  • 常量:{{ [1, 2, 3, 4.5] }}

¥Constant: {{ [1, 2, 3, 4.5] }}

  • 从上一个项目获取:{{ $json.COL_VECTOR }}

¥From a previous item: {{ $json.COL_VECTOR }}

BLOB#

  • 常量:{{ [94, 87, 34] }}{{ ' BLOB data string' }}

¥Constant: {{ [94, 87, 34] }} or {{ ' BLOB data string' }}

  • 从上一个项目获取:{{ $json.COL_BLOB }}

¥From a previous item: {{ $json.COL_BLOB }}

RAW#

  • 常量:{{ [94, 87, 34] }}

¥Constant: {{ [94, 87, 34] }}

  • 从上一个项目获取:{{ $json.COL_RAW }}

¥From a previous item: {{ $json.COL_RAW }}

BOOLEAN#

  • 常量:{{ true }}

¥Constant: {{ true }}

  • 从上一个项目获取:{{ $json.COL_BOOLEAN }}

¥From a previous item: {{ $json.COL_BOOLEAN }}

NUMBER#

  • 常量:1234

¥Constant: 1234

  • 从上一个项目获取:{{ $json.COL_NUMBER }}

¥From a previous item: {{ $json.COL_NUMBER }}

VARCHAR#

  • 常量:' Hello World '

¥Constant: ' Hello World '

  • 从上一个项目获取:{{ $json.COL_CHAR }}

¥From a previous item: {{ $json.COL_CHAR }}

这些示例假设 JSON 键(例如 COL_JSON, COL_VECTOR)直接映射到相应的 SQL 列类型。

¥These examples assume JSON keys (e.g. COL_JSON, COL_VECTOR) map directly to the respective SQL column types.