Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this article

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Overview

...

You can use the Oracle - Execute Snap to execute 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.

Note

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. 

Upcoming

Multiexcerpt include macro
nameOracle JDBC Driver Upgrade
templateDataeJyLjgUAARUAuQ==
pageOracle Snap Pack
addpanelfalse

Snap Type

Write

...

None.

Limitations and Known Issues

None.

Support for Ultra Pipelines  

Works in Ultra Pipelines

Snap Views

Type

Format

Number of Views

Examples of upstream and downstream Snaps

Description

Input 

Document

  • Min:

...

  • 1

  • Max: 1

  • Mapper

...

...

Copy Snap

...

Sequence Snap

...

  • Oracle Execute

Values to be updated in the target columns.

Output

Document

  • Min: 0

  • Max: 1

  • None

...

  • File Writer

  • Mapper

Updated records. 

Error

...

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter while running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution: Stops the current pipeline execution when the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the rest of the records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Database Write Snaps output all records of a batch (as configured in your account settings) to the error view if the write fails during batch processing.


Snap Settings

Info
  • Asterisk (*): Indicates a mandatory field.

  • Suggestion icon ((blue star) ): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon ((blue star)): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon ((blue star) ): Indicates that you can add fields in the field set.

  • Remove icon ((blue star)): Indicates that you can remove fields from the field set.

Field

Field Type

Description

Label*


Default Value: Oracle - Update
Example: Oracle - Update

String

The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.

Schema Name

...


Default Value:None
ExampleSYS

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.

Note

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

Table name*


Default

...

Value:  None
Example

...

Table name*

...

people

String/Expression/Suggestion

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.

Note

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

Update condition*

Default value:

...

Update condition*

The condition to execute an update on.

...

  None

Examples

Without using expressions

  • EmpId = 12

  • email = 'you@example.com'

Using expressions

  • "EMPNO=$EMPNO and ENAME=$EMPNAME"

  • email = $email 

  • emp=$emp

  • "emp='" + $emp + "'"

  • "EMPNO=" + $EMPNO + " and ENAME='" + $EMPNAME+ "'"

Note

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. 

String/Expression

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.

Multiexcerpt macro
nameOriginal structure_for_primary_key


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"
}
}

Image Removed

Examples

...

nameME_DB_Snaps_Query_Examples

Without using expressions

  • email = 'you@example.com' or email = $email 
  • emp=$emp

Using expressions

  • "EMPNO=$EMPNO and ENAME=$EMPNAME"
  • "emp='" + $emp + "'"
  • "EMPNO=" + $EMPNO + " and ENAME='" + $EMPNAME+ "'"

...

Using expressions that join strings together to create SQL queries or conditions has a potential SQL injection risk and hence unsafe. Ensure that you understand all implications and risks involved before using concatenation of strings with '=' Expression enabled. 

Default value:  [None]


Image Added

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

Note

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.

Number of

...

Retries

Default Value: 0
Example: 3

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.

Retry Interval (seconds)

Default value:

...

1
Example: 

...

10

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.

Session parameters


Use this fieldset to set the National Language Support (NLS) parameters. Learn more about Setting NLS Parameters.

The NLS parameters override the default value, for example, comma (,) set for the session in the initialization parameter file or set by the client with environment variables, such as a decimal point.

Session parameter name


Default value

...

: None
Example: NLS_TERRITORY

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.

Session parameter value


Default value: None
ExampleCZECH REPUBLIC

String/Expression

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

Multiexcerpt include macro
nameSnap Execution
pageSOAP Execute


Default value: Execute only
Example: Validate & Execute

Dropdown list

Multiexcerpt include macro
nameExecution_Detail_Write
pageSOAP Execute

...

Auto commit

In a scenario where the Auto commit on the account is set to true, and the downstream Snap does 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

Expand
title1. Update a record in a table

In this example, we will update a record in a table.

 Image Modified


This example updates a row of data in table TEST_EMPLOYEE which is defined as below:

Code Block
CREATE TABLE "TECTONIC"."TEST_EMPLOYEE" (    
    "Title" VARCHAR2(4000 BYTE), "Employee_Name" VARCHAR2(4000 BYTE), "Employee_ID" VARCHAR2(4000 BYTE)
);


We need to change the Title column of the row that has "Cooper" as Employee_Name to "Senior Software Engineer".

...

 First, we use a JSON Generator Snap to pass the new data:

 Image Modified


Then we set up the table name and the update condition:

...

Image Added

This is an example output of the pipeline: 

 Image Modified


Expand
title2. Error handling

...

This example pipeline demonstrates how error handling works.

...

We

...

use the same pipeline as the one used in Example #1. The difference is this time we try to update the column "Titlee" which doesn't exist in TEST_EMPLOYEE table:

 Image Modified

And this is the error message routed to the error view: 

 Image Modified


Expand
title3. Northwind sample database

In this example, we will use the well-known Northwind sample database

...

Following is a selection from the "Customers" table:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

1
 

Alfreds Futterkiste

Maria Anders

Obere Str. 57

Berlin

12209

Germany

2

Ana Trujillo Emparedados y helados

Ana Trujillo

Avda. de la Constitución 2222

México D.F.

05021

Mexico

3

Antonio Moreno Taquería

Antonio Moreno

Mataderos 2312

México D.F.

05023

Mexico

4
 

Around the Horn

Thomas Hardy

120 Hanover Sq.

London

WA1 1DP

UK

5

Berglunds snabbköp

Christina Berglund

Berguvsvägen 8

Luleå

S-958 22

Sweden
 


Assume we wish to update the customer "Alfreds Futterkiste" with a new contact person and city.

Enter Customers in the Table name property and CustomerName='Alfreds Futterkiste' in the Update condition property.

Assume that the Update Snap receives a Map data in the input view as following:

Code Block
{ "ContactName" : "Alfred Schmidt", "City" : "Hamburg" }
  

Code Block
UPDATE Customers SET ContactName='Alfred Schmidt', City='Hamburg' WHERE CustomerName='Alfreds Futterkiste';

and submit the request to the database server.

 
The selection from the "Customers" table will now look like this:

...

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

1
 

Alfreds Futterkiste

Alfred Schmidt

Obere Str. 57

Hamburg

12209

Germany

2

Ana Trujillo Emparedados y helados

Ana Trujillo

Avda. de la Constitución 2222

México D.F.

05021

Mexico

3

Antonio Moreno Taquería

Antonio Moreno

Mataderos 2312

México D.F.

05023

Mexico

4
 

Around the Horn

Thomas Hardy

120 Hanover Sq.

London

WA1 1DP

UK

5

Berglunds snabbköp

Christina Berglund

Berguvsvägen 8

Luleå

S-958 22

Sweden
 


Be careful when updating records. If we had omitted the Update condition property in the example above, the "Customers" table would have looked like this:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

1
 

Alfreds Futterkiste

Alfred Schmidt

Obere Str. 57

Hamburg

12209

Germany

2

Ana Trujillo Emparedados y helados

Alfred Schmidt

Avda. de la Constitución 2222

Hamburg

05021

Mexico

3

Antonio Moreno Taquería

Alfred Schmidt

Mataderos 2312

Hamburg

05023

Mexico

4
 

Around the Horn

Alfred Schmidt

120 Hanover Sq.

Hamburg

WA1 1DP

UK

5

Berglunds snabbköp

Alfred Schmidt

Berguvsvägen 8

Hamburg

S-958 22

Sweden
 


Snap Pack History

Insert excerpt
Oracle Snap Pack
Oracle Snap Pack
nopaneltrue