Oracle - Update

Overview

The Oracle - Update Snap executes an SQL update query with the specified properties.

Document keys are used as the columns to update, and their values are used as the updated value.

Updates will be batched up until the account's batch size property or until the structure of the update statement changes. An update statement will change if an incoming document contains different keys than a previous document.

Important: JDBC Driver upgrade and behavior change

The Oracle JDBC Driver is upgraded from OJDBC6 JAR (v11.2.0.4) to OJDBC10 JAR (v19.20.0.0) in the latest distribution in October 2023 and deployed to the stable distribution in the November 2023 release (after the Snaplex upgrade). The latest JDBC driver upgrade is backward-compatible. Learn more: Oracle JDBC driver and JOOQ upgrades.

You can consume this driver upgrade with the 434patches23000 Snap Pack version.

This JDBC driver upgrade has resulted in specific behavior changes that include errors, status codes, and success and failure messages. Learn more about the behavior changes to ensure your migration to the upgraded driver is seamless.

Prerequisites

None.

Snap views

Type Description Examples of upstream and downstream Snaps
Input

This Snap has exactly one document input view.

Values to be updated in the target columns.

Output

This Snap has at most one document output view.

Updated records.

Learn more about Error handling.

Snap settings

Legend:
  • Expression icon (): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field/Field set Description

Label

String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Oracle - Update

Schema Name

String/Expression/ Suggestion

Specify the database schema name. The suggestions in the Schema field are populated only when at least a single table exists in the schema. If no tables exist to use that schema, only SYS, SYSTEM, and XDB are populated.

The values can be passed using the pipeline parameters but not the upstream parameter.

Default value: None

Example: SYS

Table name*

String/Expression/ Suggestion

Required. Specify the name of the table to execute the update operation on. This list is populated based on the tables associated with the selected schema.

The values can be passed using the pipeline parameters but not the upstream parameter.

Default value: None

Example: people

Update condition*

String/Expression

Required. Specify the SQL WHERE clause of the update statement. You can define specific values or columns to update (Set condition) in the upstream Snap, such as Mapper Snap, and then use the WHERE clause to apply these conditions on the columns sourced from the upstream Snap. For instance, here is a sample of an Update SQL query:

UPDATE table_name SET column1 = value1, column2 = value2, WHERE condition;

  • If the Update Condition field is left blank, the condition is applied on all the records of the target table.
  • Instead of building multiple Snaps with inter dependent DML queries, we recommend that you use the Oracle - Stored Procedure Snap. In a scenario where the downstream Snap depends on the data processed on an Upstream Database Bulk Load Snap, use the Script Snap to add delay for the data to be available.

In certain scenarios where you want to use specific data from the upstream Snaps, and do not want to change that data in the Update Snap, then you need to place the data in the original structure of the input document. Hence, we recommend that you use the format for Update condition and input data format as shown below:

{ "valueToUpdate" : "true", "original": { "col1" : "KEY" } }



Refer to the example to understand how the Update Condition works.

If Batch size in your account is greater than one, do not toggle on the expression button if a dynamic argument needs to be defined referencing several input documents.

Default value: None

Examples:

Without using expressions

Using expressions

  • "EMPNO=$EMPNO and ENAME=$EMPNAME"
  • email = $email
  • emp=$emp
  • "emp='" + $emp + "'"
  • "EMPNO=" + $EMPNO + " and ENAME='" + $EMPNAME+ "'"
Warning: Using expressions that join strings together to create SQL queries or conditions has a potential SQL injection risk and is hence unsafe. Ensure that you understand all implications and risks involved before using concatenation of strings with '=' Expression enabled.
Number of Retries

Integer/Expression

Specifies the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response.

This field does not support values from upstream Snaps when you enable the expression icon; it can accept values only from Pipeline parameters.

Default value: 0

Example: 3

Retry Interval (seconds)

Integer/Expression

Specifies the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception.

This field does not support values from upstream Snaps when you enable the expression icon; it can accept values only from Pipeline parameters.

Default value: 1

Example: 10

Session parameter name

String/Expression

Specify the name of the NLS parameter.

  • This Snap supports the Enable, Disable, and Force commands in session parameters.
  • This field supports only pipelines parameters, and not upstream values.

Default value: None

Example: NLS_TERRITORY

Session parameter value

String/Expression

Specify the value for the NLS parameter. This field supports only pipelines parameters, and not upstream values.

Default value: None

Example: CZECH REPUBLIC

Snap execution

Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Execute only

Example: Validate & execute

Auto commit

In a scenario where the Auto commit on the account is set to true, and the downstream Snap depends on the data processed on an Upstream Database Bulk Load Snap, use the Script Snap to add delay for the data to be available. For example, when performing a create, insert and a delete function sequentially on a pipeline, using a Script Snap helps in creating a delay between the insert and delete function or otherwise it may turn out that the delete function is triggered even before inserting the records on the table.

Examples

  1. Update a record in a table
  2. Error handling of the Snap (Oracle Update)
  3. Northwind sample database