On this Page
On this Page
Table of Contents | ||||
---|---|---|---|---|
|
Overview
You can use this Snap to execute stored procedures in an Oracle database and write OUTparameter values to the output view. If an OUT parameter is:
Custom type OBJECT, then the output is displayed as a JSON object.
Custom type TABLE, then the output is displayed as a JSON array.
This Snap supports executing stored functions with OUT and INOUT parameters and writes these parameters in the output view along with the returnval
key.
Multiexcerpt include macro name Oracle JDBC Driver Upgrade templateData eJyLjgUAARUAuQ== page Oracle Snap Pack addpanel false
Snap type: | Write | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples: | Example 1: Stored procedure has output parameters firstName, lastName and both are of built-in type VARCHAR2. The output document is:
Example 2: Stored procedure has three output parameters firstName, lastName, and hobbies where firstName and lastName are of built-in type VARCHAR2 and hobbies is of custom type TABLE. The output document is:
Example 3: Stored procedure has three output parameters firstName, lastName, and location where firstName and lastName are of built-in type VARCHAR2 and location is of custom type OBJECT. The output document is:
Example 4: Stored function accepts a customerId (NUMBER) and returns the customer's name (VARCHAR2).
| ||||||||||||||
Prerequisites: | None | ||||||||||||||
Known Issues |
| ||||||||||||||
Support | Works in Ultra Task Pipelines. | ||||||||||||||
Account: | This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Oracle Account for information on setting up this type of account. | ||||||||||||||
Views: |
| ||||||||||||||
Settings | |||||||||||||||
Label | Required. 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 | The schema name where the procedure resides. The property is suggestible and will return all schemas of the DB. Note | Specify the database schema name. Selecting a schema, filters the Table name list to show only those tables within the selected schema. 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. You can pass the values as expressions using the pipeline parameters but cannot use values from the upstream Snap. Default value: None | |||||||||||||
Package name | The package name where the procedure resides. The property is suggestible and will return all packages of the DB. If a schema is defined, then it will only return the packages of that schema. To invoke stored functions in a package, you need to upgrade the Oracle JDBC driver to 12.1.0.2 or later.
| ||||||||||||||
Stored Procedure Name | Required. Stored procedure to execute. The property is suggestible and will return all procedures of the DB. If a package is defined, then it will only return the procedures of that package. If a schema is defined and no package is defined, then it will return all procedures of that schema. Example: addSeventeen | ||||||||||||||
Procedure sequence | Required for overloaded procedures. Sequence number that indicates the procedure to be used for overloaded procedures. The property is optional and only to be used when the selected procedure is overloaded. The starting index is always 1. The property is suggestible and will return the available indexes of the overloaded procedure, if any. The procedure sequence instructions apply similarly to stored functions. Example:
| ||||||||||||||
Ignore Null Parameters |
| ||||||||||||||
Parameter Values | Select the input parameter values for the stored procedure. If you define parameter values, you must do so in the same order as they appear in the stored procedure definition. Example: There is a stored procedure named createGreeting. It has two input parameters: p1 and p2 of type VARCHAR2. Then you need to provide two string values. The first value goes to p1 and the second value goes to p2. Default value: [None]
| ||||||||||||||
Pass through | If selected, the input document will be passed through to the output views under the key 'original'. The document will be passed to the Parameter output view, and it will also be passed to the Result Set output view if there is output sent from this view.
Default value: Not selected | ||||||||||||||
Custom type parameters mapping optional | Supports mappings for all parameters. | ||||||||||||||
Parameter index | The index is of the custom type parameter. It is suggestible based on stored procedure name.
| ||||||||||||||
Parameter type | The custom type name the parameter is of. Its suggestible based on database account. | ||||||||||||||
|
|
Examples
We will provide two examples, the first one calls a simple stored procedure, the second one calls a procedure with user-defined type parameters.
Expand | ||
---|---|---|
| ||
In this example we want to call stored procedure TEST_PROC. Here is the definition of stored procedure TEST_PROC:
First, we use an Oracle Execute Snap, to get some input data from table TEST_TABLE. Then, we use a Mapper Snap to map the data from the Oracle - Execute Snap to the Target paths, which the Oracle Stored Procedure Snap uses later. In the Oracle Stored Procedure Snap, we define the stored procedure and parameters. Upon validation, we see the output preview of the Oracle Stored Procedure Snap as shown below: |
Expand | ||
---|---|---|
| ||
In this example we will call a Oracle Stored Procedure PROC_WITH_CUSTOM_IN_PARAM which has parameters of user-defined types. Here is the definition of the stored procedure PROC_WITH_CUSTOM_IN_PARAM:
First we use a JSON Generator Snap to pass parameter values as shown below to the Stored Procedure Snap: Then we use the Stored Procedure Snap procedure name and define parameter values. As there are several parameters that are user-defined types, we add custom type mapping for them. Each mapping row consists of parameter index and type. Parameter index is the index when it is defined, and the parameter type is the name of the user-defined type. You can also use the Suggest button to get the list of available indices or types and select the needed one. Upon validation, we see the output preview of the Oracle - Stored Procedure Snap as shown below: |
Expand | ||
---|---|---|
| ||
This Pipeline demonstrates invoking a stored function using the Oracle Stored Procedure Snap by defining a custom type mapping and documenting the indexing behavior. The return value has index 1 and the first parameter has index 2. The code in the following section defines the stored function - payroll_pkg.employee_info.
We use the Oracle Execute Snap to query people table. Then, we use the Mapper Snap to map Employee ID and Full name. We use the Oracle - Stored Procedure Snap and select the stored procedure. The Oracle Stored Procedure Snap invokes a stored function to lookup employee information, such as the employee's salary and hire date. The function accepts an Employee ID and returns a table of custom types (employee). |
Downloads
Multiexcerpt include macro | ||||
---|---|---|---|---|
|
Attachments | ||
---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|