Using Variables in Interfaces

12-18 Oracle Fusion Middleware Developers Guide for Oracle Data Integrator 3. Define one physical data server for all your stores and set its JDBC URL to: jdbc:oracle:thin:EDW.STORE_URL 4. Define your package for loading data from your store. The input variable STORE_ID will be used to refresh the values for STORE_URL and STORE_ACTIVE variables from the StoresLocation table. If STORE_ACTIVE is set to “YES”, then the next 3 steps will be triggered. The interfaces refer to source datastores that the agent will locate according to the value of the STORE_ URL variable. To start such a scenario on Unix for the New York store, you would issue the following operating system command: startscen.sh LOAD_STORE 1 PRODUCTION “EDW.STORE_ID=3” If you want to trigger your LOAD_STORE scenario for all your stores in parallel, you would simply need to create a procedure with a single SELECTaction command as follows: The LOAD_STORE scenario will then be executed for every store with the appropriate STORE_ID value. The corresponding URL will be set accordingly. Refer to Binding Source and Target Data and Section 4.3, Managing Agents for further details.

12.2.3.8 Using Variables in On ConnectDisconnect Commands

Variables can be used in the On connectDisconnect SQL commands. See Section 4.2.2.3, Creating a Data Server Advanced Settings for more information.

12.2.3.9 Passing a Variable to a Scenario

It is also possible to pass a variable to a scenario in order to customize its behavior. To do this, pass the name of the variable and its value on the OS command line which executes the scenario. For more information, see Section 20.3.2, Executing a Scenario from a Command Line .

12.2.3.10 Generating a Scenario for a Variable

It is possible to generate a single step scenario for running a variable. How to generate a scenario for a variable is covered in Section 13.2, Generating a Scenario . Table 12–7 SELECTaction command Source Technology Oracle technology of the data server containing the StoresLocation table. Source Logical Schema Logical schema containing the StoresLocation table. Source Command Select StoreId From StoresLocation Target Technology ODITools Target Logical Schema None Target Command SnpsStartScen “-SCEN_NAME=LOAD_STORE” “-SCEN_VERSION=1” “-SYNC_MODE=2” “-EDW.STORE_ID=StoreId” Working with Procedures, Variables, Sequences, and User Functions 12-19

12.3 Working with Sequences

This section provides an introduction to sequences and describes how to create and use sequences in Oracle Data Integrator.

12.3.1 Introduction to Sequences

A Sequence is a variable that increments itself automatically each time it is used. Between two uses, the value can be stored in the repository or managed within an external RDBMS table. Sequences can be strings, lists, tuples or dictionaries. Oracle Data Integrator sequences are intended to map native sequences from RDBMS engines, or to simulate sequences when they do not exist in the RDBMS engine. Non-native sequences’ values can be stored in the Repository or managed within a cell of an external RDBMS table. A sequence can be created as a global sequence or in a project. Global sequences are common to all projects, whereas project sequences are only available in the project where they are defined. Oracle Data Integrator supports three types of sequences: ■ Standard sequences , whose current values ares stored in the Repository. ■ Specific sequences , whose current values are stored in an RDBMS table cell. Oracle Data Integrator reads the value, locks the row for concurrent updates and updates the row after the last increment. ■ Native sequence , that maps a RDBMS-managed sequence. Note the following on standard and specific sequences: ■ Oracle Data Integrator locks the sequence when it is being used for multi-user management, but does not handle the sequence restart points. In other words, the SQL statement ROLLBACK does not return the sequence to its value at the beginning of the transaction. ■ Oracle Data Integrator standard and specific sequences were developed to compensate for their absence on some RDBMS. If native sequences exist, they should be used. This may prove to be faster because it reduces the dialog between the agent and the database. The following sections describe how to create and use sequences.

12.3.2 Creating Sequences

The procedure for creating sequences vary depending on the sequence type. Refer to the corresponding section: ■ Creating Standard Sequences ■ Creating Specific Sequences ■ Creating Native Sequences

12.3.2.1 Creating Standard Sequences

To create a standard sequence:

1. In Designer Navigator select the Sequences node in a project or the Global

Sequences node in the Others view. 2. Right-click and select New Sequence. The Sequence Editor opens.