Oracle - Execute
In this article
Overview
You can use this Snap to execute an Oracle statement or query. This is a Write Snap type. This Snap works only with single queries.
This Snap:
is for simple DML (SELECT, INSERT, UPDATE, DELETE) type statements. For the comprehensive scripting functionality offered by various databases, use stored procedure functionality offered by their chosen database using the Stored Procedure Snap.
might drop your database, hence be cautious.
If you execute a SELECT query, the query's results are merged into the incoming document and the values of any existing keys will be overwritten. On the other hand, if there are no results from the query, the original document is written.
Any valid JSON paths that you define in the WHERE clause for queries/statements are substituted with values from an incoming document. Documents will be written to the error view if the document is missing a value to be substituted into the query/statement.
Upcoming
Prerequisites
None.
Support for Ultra Pipelines
Works in Ultra Pipelines.
Limitations
Due to the limitation in Oracle JDBC driver, the SQL statement cannot have semicolons at the end except that it is a BEGIN-END block.
This Snap cannot invoke procedures, hence we recommend that you use Oracle Stored Procedure Snap for invoking procedures.
Known Issues
When the SQL statement property is an expression, the Pipeline parameters are shown in the Suggest, but not the input schema.
Breaking change
With the 439patches29008 Snap Pack version if any of your existing Oracle pipelines use the encoded ROWID(by manually handling the Base64 encoded data), your pipelines might break. To prevent your pipelines from failing, you must update your Snap Pack version to the latest version.
Behavior Change
Earlier, the
ROWIDcolumns were displayed in binary (Base64 encoded data) form in the output. With the439patches29008, the Oracle Execute and Select Snaps display theROWIDcolumns in string form in the output (which can be used for other operations downstream).As part of
main23721(because of the JOOQ upgrade) previously, when you used a stored procedure in the Oracle-Execute Snap, the Snap displayed aMessage:Successin the output. Now, the Snap displays$UPDATE_COUNT=-1.As part of
436patches25696, when you use a stored procedure in the Oracle - Execute Snap, the Snap displaysMessage: Successand$UPDATE_COUNT=-1, 0, or 1(based on the Snap Pack behavior) in the output.
Snap Input and Output
Input/Output | Type of view | Number of views | Examples of Upstream/Downstream Snap | Description |
|---|---|---|---|---|
Input | Document |
|
| This Snap has at most one document input view. If the input view is defined, then the where clause can substitute incoming values for a given expression. |
Output | Document |
|
| This Snap has at most one document output view. If an output view is available and an update/insert/merge/delete statement was executed, then the original document that was used to create the statement will be output with the status of the statement executed. 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
Field | Field Type | Description | ||
|---|---|---|---|---|
Label*
| String | Enter a unique 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. Default Value: Oracle Execute | ||
SQL statement*
| String | Specify the SQL statement to execute on the server. Executing SQL statements in SnapLogic You must understand the following scenarios to successfully execute your SQL statements: Scenario 1: Executing SQL statements without expressions
Examples: Additionally, the JSON path is allowed only in the WHERE clause. If the SQL statement starts with SELECT (case-insensitive), the Snap regards it as a select-type query and executes once per input document. If not, it regards it as write-type query and executes in batch mode. If your Oracle table has columns whose names contain a '$' (or any other special character) in it, enclose the column name within quotes, such as:
Scenario 2: Executing SQL queries using expressions
Examples:
We recommend you to use the Oracle Stored Procedure Snap for invoking procedures as the Oracle Execute Snap has the following limitation while invoking procedures:
Oracle JDBC documentation recommends using
Single quotes in values must be escaped Any relational database (RDBMS) treats single quotes ( For example: Default Value: [None] | ||
Query type | Dropdown list/Expression | Select the type of query for your SQL statement (Read or Write). When Auto is selected, the Snap tries to determine the query type automatically. Default Value: Auto | ||
Pass through
| Checkbox | Select this checkbox to pass the input document to the output view under the key ' Default Value: Selected
| ||
Ignore empty result
| Checkbox | Select this checkbox to not write any document to the output view when a SELECT operation does not produce any result. Default Value: Not selected
| ||
Auto commit | Dropdown list | Choose one of the options from the list to override the state of the Auto commit on the account. The available options are:
Default Value: Use account setting 'Auto commit' may be enabled for certain use cases if PostgreSQL jdbc driver is used in either Redshift, PostgreSQL or generic JDBC Snap. But the JDBC driver may cause out of memory issues when Select statements are executed. In those cases, “Auto commit" in Snap property should be set to ‘False’ and the Fetch size in the “Account setting" can be increased for optimal performance. Behavior of DML Queries in Database Execute Snap when auto-commit is false DDL queries used in the Database Execute Snap will be committed by the Database itself, regardless of the Auto-commit setting. | ||
Number of retries | Integer |
Default Value: 0 | ||
Retry interval (seconds) | Integer | Specify the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception. Default Value: 1 | ||
Column-specific timestamp precision | Checkbox | Select this checkbox to display the timestamp with millisecond/microsecond/nanosecond precision in string type. By default, the checkbox is deselected, which maintains the backward compatibility (supports only millisecond of date time type). Default Value: Deselected | ||
Snap Execution | Dropdown list | |||
Examples