Stored Procedure Transformation in Informatica

The Stored Procedure Transformation in Informatica helps you to use or call Stored procedures inside the Informatica Workflow. Using this transformation, you can operate Drop or Recreate Indexes, Check for Space in a Database, performing Complex Calculations.

This article shows how to use this Informatica Stored procedure Transformation to Rollback the passing records with an example. For this Informatica Stored Procedure Transformation example, we are going to use SP Source and Destination tables.

Stored Procedure Transformation in Informatica 1

And the Stored procedure that we are going to use is:

Stored Procedure Transformation in Informatica 2

From the above screenshot, you can see, that the stored procedure has one input parameter and one output parameter

TIP: We explained everything about the Stored procedure and its functionalities in the SQL Server tutorial. I suggest you refer Stored Procedures article to understand the topic.

Stored Procedure Transformation in Informatica Example

Let us see how to use Stored Procedure Transformation in Informatica to call stored procedures inside an Informatica Workflow. Before we start configuring, First, let me connect with the Informatica repository service.

To do so, we have to provide the Admin Console credentials. So, Please provide the appropriate Username and Password you specified while installing the Informatica Server.

Source Definition for Stored Procedure Transformation in Informatica

Once you connected successfully, Please navigate to Source Analyzer and define your Sources. Here, we are using the Sp Source table from the SQL database as our source definitions. Please refer Database Source in Informatica to understand the steps in creating source definition

Stored Procedure Transformation in Informatica 3

Create Target Definition for Stored Procedure Transformation

Please navigate to Target Designer to define the Informatica Stored Procedure Transformation Target. In this example, we are using the existing SQL table (SP Destination) as our target definition. You can refer to Create Target Table to understand the process of creating a target definition

Stored Procedure Transformation in Informatica 4

Create Mapping for Informatica Stored Procedure Transformation

To create a new mapping, Please navigate to the Mappings menu in Menu Bar and select the Create.. option.

Stored Procedure Transformation in Informatica 5

Once you select the Create.. option, a new Mapping Name window will open. Let me provide m_StoreProc as the mapping name and click the OK button.

TIP: Please refer Informatica Mapping article to understand the procedure to create Mapping

Stored Procedure Transformation in Informatica 6

Drag and drop the SP Source from Sources folder to the mapping designer. Once you drag the source, Power Center Designer will automatically create the Source Qualifier Transformation (default transformation) for you.

Stored Procedure Transformation in Informatica 7

Create Informatica Stored Procedure Transformation

To create Stored Procedure Transformation in Informatica, Please navigate to the Transformation menu in Menu Bar. Next, select the Create.. option

Stored Procedure Transformation in Informatica 8

Selecting the Create.. option will open the Create Transformation window. Please select the Stored procedure Transformation from the drop-down list and provide a unique name (sp_Testing) and click on Create button

Stored Procedure Transformation in Informatica 9

Clicking the Create button will pop up a new window called Import Stored Procedure. Please select the ODBC connection that will connect with the Informatica Source. It is where our Stored procedure created. To create a new ODBC Connection, please refer to the Informatica ODBC Connection article.

From the below screenshot, see that we are selecting the spUpdateCust stored procedure.

Stored Procedure Transformation in Informatica 10

By clicking OK will create a Informatica Stored Procedure Transformation for you. As you can see from the below screenshot, it has three ports: Return_value, EmpId, and New Income

Stored Procedure Transformation in Informatica 11

Next, Drag and drop the target definition (SPDestination) from the Targets folder to the mapping designer.

Stored Procedure Transformation in Informatica 12

Next, we are connecting the EmpId from Source Qualifier to Stored Procedure Transformation. Because spUpdateCust accepts one input parameter (EmpId) to return New Income output.

Stored Procedure Transformation in Informatica 13

Double click on the Informatica Stored Procedure Transformation to see and alter the properties. Below screenshot shows you the list of available properties in the Transformation tab:

  • Select Transformation: By default, it will select the transformation you selected (or clicked on).
  • Rename: This button helps you to rename the Stored Procedure Transformation name.
  • Description: Use this place to provide a valid description of this transformation.
Stored Procedure Transformation in Informatica 14

Below screenshot shows you the available options in the Informatica stored procedure transformation Ports tab:

  • Port Name: List of available column names. Use the New column button to add new columns, scissors button to delete the unwanted columns.
  • I: Stored Procedure Transformation Input columns.
  • O: Here, Columns that are check-marked are the Stored Procedure Transformation Output columns.
Stored Procedure Transformation in Informatica 15

Within the properties tab, click on the Arrow button beside the Connection Information type, and use the Connection variable $Source because we used the Stored procedure that exists in information Source.

Stored Procedure Transformation in Informatica 16

Drag and drop all the fields that exist in source qualifier Transformation to target definition. Please use the Autolink.. option to connect them. Next, connect the NewIncome field in Store procedure transformation with target definition.

Stored Procedure Transformation in Informatica 17

Before we close the Mapping, Let us Save, and Validate the mapping by going to Mapping Menu bar, and select the Validate option.

Create Workflow for Stored Procedure Transformation in Informatica

After you finish creating the Informatica Stored Procedure Transformation Mapping, we have to create the workflow for it. PowerCenter Workflow manager provides two approaches to create a workflow.

In this Informatica Stored Procedure Transformation example, we will create the Workflow manually. To do so, Please navigate to Workflows Menu and select the Create option.

Stored Procedure Transformation in Informatica 18

It opens the Create Workflow window. Please provide the unique name (wf_StoredProc) and leave the default settings.

Stored Procedure Transformation in Informatica 19

Once we created the workflow, our next step is to create a session task for our mapping.

Create Session for Stored procedure Transformation in Informatica

There are two types of sessions in Informatica:

For this Informatica Stored Procedure Transformation example, we created a Non-reusable Session. To create Non-reusable Session, Please navigate to Tasks Menu and select the Create option.

Stored Procedure Transformation in Informatica 20

Please provide a unique name for this session. Here, we are naming it as s_StoredProc. Once you click on the Create button, a new window called Mappings will open. Here you have to select the Mapping that you want to associate with this session, i.e., m_Storedproc.

Stored Procedure Transformation in Informatica 21

Double click on the Session task will open the Edit Tasks window. Within Properties Tab

$Source connection value: This property will store the relational source information in the $Source variable. So, click on the Arrow we marked below, and select the Informatica Source as the source information.

Stored Procedure Transformation in Informatica 22

$Target connection value: This property will store the relational target information in the $Target variable. So, click on the Arrow we marked below, and select the Informatica Target as the Target information.

Stored Procedure Transformation in Informatica 23

Within the mappings tab, we have to configure the Source and Target Connections. First, let us configure the source connections by clicking on the SQ_SPSource source present in the Sources folder.

Within the Connections, click on the Arrow button beside the Relational type. And use the Connection variable that we created in our previous step i.e., $Source

Stored Procedure Transformation in Informatica 24

Now, we have to configure the Target Connection. So, click on the SPDestination present in the Targets folder. Within the Connections, click on the Arrow button beside the Relational type, and use the Connection variable $Target

Stored Procedure Transformation in Informatica 25

Here, we can also configure the connection information of a Stored Procedure Transformation. To do so, click on the SP_Testing present in the Transformations folder.

Stored Procedure Transformation in Informatica 26

Next, navigate to Workflows Menu and select the Validate option to validate the Workflow.

Stored Procedure Transformation in Informatica 27

Now, Let me start the Informatica Stored Procedure Transformation Workflow. To do so, navigate to the Workflows menu and select the Start Workflow option.

Stored Procedure Transformation in Informatica 28

Let us open the SQL Server Management Studio and write the following SQL Query.

Stored Procedure Transformation in Informatica 29