Fill in the following fields:

Working with Procedures, Variables, Sequences, and User Functions 12-7 However, use caution when using this mechanism as it can lead to deadlocks across sessions in a parallel environment. Binding Source and Target Data Data binding in Oracle Data Integrator is a mechanism in procedures that allows performing an action for every row returned by a SQL SELECT statement. To bind source and target data: 1. Open the Command Line Editor.

2. In the Command on Source tab, specify the SELECT statement.

3. In the Command on Target tab, specify the action code. The action code can itself

be an INSERT, UPDATE or DELETE SQL statement or any other code such as an ODI Tool call, Jython or Groovy. Refer to Appendix A, Oracle Data Integrator Tools Reference for details about the ODI Tools syntax. The values returned by the source result set can be referred to in the action code using the column names returned by the SELECT statement. They should be prefixed by colons “:” whenever used in a target INSERT, UPDATE or DELETE SQL statement and will act as “bind variables”. If the target statement is not a DML statement, then they should be prefixed by a hash “” sign and will act as substituted variables. Note also that if the resultset of the Source tab is passed to the Target tab using a hash sign, the target command is executed as many times as there are values returned from the Source tab command. The following examples give you common uses for this mechanism. There are, of course, many other applications for this powerful mechanism. Example 12–1 Loading Data from a Remote SQL Database Suppose you want to insert data into the Teradata PARTS table from an Oracle PRODUCT table. Table 12–1 gives details on how to implement this in a procedure step. ODI will implicitly loop over every record returned by the SELECT statement and bind its values to “:MY_PRODUCT_ID” and “:PRODUCT_NAME” bind variables. It then triggers the INSERT statement with these values after performing the appropriate data type translations. Table 12–1 Procedure Details for Loading Data from a Remote SQL Database Source Technology Oracle Source Logical Schema ORACLE_INVENTORY Source Command select PRD_ID MY_PRODUCT_ID, PRD_NAME PRODUCT_NAME, from =odiRef.getObjectNameL,PRODUCT,D Target Technology Teradata Target Logical Schema TERADATA_DWH Target Command insert into PARTS PART_ID, PART_ORIGIN, PART_NAME values :MY_PRODUCT_ID, ’Oracle Inventory’, :PRODUCT_NAME