Using Variables in On ConnectDisconnect Commands

12-22 Oracle Fusion Middleware Developers Guide for Oracle Data Integrator ■ In the SQL statement insert into fac select :NO_FAC_NEXTVAL, date_ fac, mnt_fac the value of a standard or specific sequence will be incremented only once, even if the SQL statement processes 10,000 rows, because the agent does not process each record, but just sends the command to the database engine. A native sequence will be incremented for each row. ■ To increment the value of a standard or specific sequence for each row, the data must pass through the agent. To do this, use a KM or procedure that performs a SELECT on the source command and an INSERT on the target command: SELECT date_fac, mnt_fac on the source connection INSERT into FAC ORDER_NO, ORDER_DAT, ORDER_AMNT values :NO_FAC_NEXTVAL, :date_fac, :mnt_fac on the target connection Sequence Scope Unlike for variables, you do not need to state the scope of sequences explicitly in code.

12.3.3.1 Tips for Using Standard and Specific Sequences

To make sure that a sequence is updated for each row inserted into a table, each row must be processed by the Agent. To make this happen, follow the steps below:

1. Make the mapping containing the sequence be executed on the target.

2. Set the mapping to be active for inserts only. Updates are not supported for

sequences.

3. If you are using an incremental update IKM, you should make sure that the

update key in use does not contain a column populated with the sequence. For example, if the sequence is used to load the primary key for a datastore, you should use an alternate key as the update key for the interface.

4. If using Oracle Data Integrator sequences with bind syntax :SEQUENCE_

NAME_NEXTVAL, you must configure the data flow such that the IKM transfers all the data through the agent. You can verify this by checking the generated integration step in Operator. It should have separate INSERT and SELECT commands executed on different connections, rather than a single SELECT...INSERT statement. Limitations of Sequences Sequences have the following limitations: ■ A column mapped with a sequence should not be checked for not null. ■ Similarly, static control and flow control cannot be performed on a primary or alternate key that references the sequence.

12.3.3.2 Identity Columns

Certain databases also natively provide identity columns, which are automatically populated with unique, self-incrementing values. When populating an identity column, you should follow these steps: 1. The mapping loading the identity column should be blank and inactive. It should not be activated for inserts or updates.