You are on page 1of 4

Transaction Control

TRANSACTION CONTROL TRANSFORMATION IN INFORMATICA

Transaction Control is an active and connected transformation. The transaction control transformation is used to control the commit and rollback of transactions.

In Informatica, you define transaction control at the following levels: Within a mapping. Within a mapping, you use the Transaction Control transformation to define a transaction. You define transactions using an expression in a Transaction Control transformation. Based on the return value of the expression, you can choose to commit, roll back, or continue without any transaction changes. Within a session. When you configure a session, you configure it for user-defined commit. You can choose to commit or roll back a transaction if the Integration Service fails to transform or write any row to the target. When you run a session, the integration service evaluates the expression for each row in the transaction control transformation. When it evaluates the expression as commit, then it commits all the rows in the transaction to the target(s). When the integration service evaluates the expression as rollback, then it roll back all the rows in the transaction from the target(s). When you have flat file as the target, then the integration service creates an output file for each time it commits the transaction. You can dynamically name the target flat files. Look at the example for creating flat files dynamically - Dynamic flat file creation.
Creating Transaction Control Transformation

Follow the below steps to create transaction control transformation: Go to the mapping designer, click on transformation in the toolbar, Create. Select the transaction control transformation, enter the name and click on Create and then Done. You can drag the ports in to the transaction control transformation Go to the properties tab. Enter the transaction control expression in the Transaction Control Condition.

Configuring Transaction Control Transformation

You can configure the following components in the transaction control transformation: Transformation Tab: You can rename the transformation and add a description. Ports Tab: You can create input/output ports Properties Tab: You can define the transaction control expression and tracing level. Metadata Extensions Tab: You can add metadata information.
Transaction Control Expression

You can enter the transaction control expression in the Transaction Control Condition option in the properties tab. The transaction control expression uses the IIF function to test each row against the condition.

Use the following syntax for the expression


Syntax: IIF (condition, value1, value2) Example: IIF(dept_id=10, TC_COMMIT_BEFORE,TC_ROLLBACK_BEFORE)

Use the following built-in variables in the expression editor of the transaction control transformation: TC_CONTINUE_TRANSACTION: The Integration Service does not perform any transaction change for this row. This is the default value of the expression. TC_COMMIT_BEFORE: The Integration Service commits the transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction. TC_COMMIT_AFTER: The Integration Service writes the current row to the target, commits the transaction, and begins a new transaction. The current row is in the committed transaction. TC_ROLLBACK_BEFORE: The Integration Service rolls back the current transaction, begins a new transaction, and writes the current row to the target. The current row is in the new transaction. TC_ROLLBACK_AFTER: The Integration Service writes the current row to the target, rolls back the transaction, and begins a new transaction. The current row is in the rolled back transaction. If the transaction control transformation evaluates to a value other than the commit, rollback or continue, then the integration service fails the session.

Example to Transaction Control: Step 1: Design the mapping.

Step 2: Creating a Transaction Control Transformation. In the Mapping Designer, click Transformation > Create. Select the Transaction Control transformation. Enter a name for the transformation.[ The naming convention for Transaction Control transformations is TC_TransformationName]. Enter a description for the transformation. Click Create. Click Done. Drag the ports into the transformation. Open the Edit Transformations dialog box, and select the Ports tab. Select the Properties tab. Enter the transaction control expression that defines the commit and roll back behavior.

Go to the Properties tab and click on the down arrow to get in to the expression editor window. Later go to the Variables tab and Type IIF(EMpno=7654,) select the below things from the built in functions. IIF (EMPNO=7654,TC_COMMIT_BEFORE,TC_CONTINUE_TRANSACTION) Connect all the columns from the transformation to the target table and save the mapping. Select the Metadata Extensions tab. Create or edit metadata extensions for the Transaction Control transformation. Click OK. Step 3: Create the task and the work flow. Step 4: Preview the output in the target table.

You might also like