✍ Kashif M
Trends

Monday, 9 September 2013


Stored Procedure Transformations In Informatica


By on September 09, 2013



STORED PROCEDURE


  • A procedure is a pre-defined set of PL/SQL statements to carry out a task. 

  • It is a Passive Transformation 

  • It is used to manage (USED BY DBA) and populate (USED BY DEVELOPER) the target database. 

  • Operations accomplished through Stored Procedures



With Stored Procedures we can do the following operations: 

Checking the Target Disk availability.

If we want to load the data to the target, before loading we need to make sure if there is enough space on the target disk. Used by DBA.
Check the Target table availability.

If the target is used in some other mapping, it cannot be used at the same time. Example three different mappings (one for INSERT, DELETE and UPDATE) can be used for the same target. Used by DBA.
Dropping and Recreating Indexes.

For Bulk Loading, we need to drop the index first and recreate the index after the load is done.
Perform specialized calculations.


Types of Stored Procedure Transformations
Normal
Source Pre-load or Pre-Source Load
Source Post Load or Post Source Load 

Pre-target Load or Target Pre-Load
Post-Target Load or Target Post-Load



Normal

By default, SP type is normal. It can be used for calculations. It can be used in two different types of transformations – connected SP or unconnected SP.
Source Pre-Load or Pre-Source Load

By using Source Pre-load, we can execute a procedure against Source Database before Source (SQ) executes.
Source Post Load or Post Source Load

By using Source Post load, we can execute a procedure against Source database after Source Query (SQ) executes. Example – Indexes
Pre-target Load or Target Pre-Load

Before executing the target process or query on the target, we can use SP executing against the target database.
Post-Target Load or Target Post-Load

After executing the target process or query on the target, we can use SP executing against the target database. Example, Recreating the Index.


Ports:

Input,Output,Return

Suppose we have a stored procedure to calculate annual salary of an employee.

Input Parameter is SAL and output is AN_SAL.

SQL> create or replace procedure calc_an_sal(p_sal IN emp.sal%TYPE,

p_an_sal OUT emp.sal%TYPE)

IS

BEGIN

p_an_sal:=P_SAL*12; (Bad Practice )

select sal*12

INTO p_an_sal

FROM EMP

WHERE sal=p_sal;

END;

Procedure created.

SQL> variable an_sal number;

SQL> execute calc_an_sal(1300,:an_sal);

PL/SQL procedure successfully completed.

SQL> print an_sal

AN_SAL

----------

15600





Define a Mapping M_SP. Drag Source (EMP),Target (EMP_SP) to the mapping designer.

Create a Stored Procedure transformation T_SP.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica



Connect to the database which has the required SP. In our case we have the SP to calculate annual salary on the Source Database (SCOTT).

Form the Procedures tab select calc_an_sal.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica


Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica






Edit the SP transformation and go to Ports tab.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica



In the Transformation T_SP we have P_SAL (input parameter) and P_AN_SAL (output parameter).






Connect Source port Sal to Transformation port P_SAL, transformation port P_AN_SAL to the target port AN_SAL. Project the remaining ports directly from source to the target.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica








Edit the Transformation and go to Properties tab.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica








By default, the value for connection information is $target.

In our case, we have defined the SP on Source (SCOTT) so we select that.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica




Stored Procedure Type is Normal.

Stored Procedure Transformations In Informatica

Save the repository.




Define the workflow. Assign Source, Target and Transformation Connections.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica







Define a workflow.

Assign the source,target and Transfromation (SP) connections.

Start the workflow and preview the output.
Stored Procedure Transformations In Informatica
Stored Procedure Transformations In Informatica

Kashif
mkashu: Stored Procedure Transformations In Informatica
Review : Kashif | Kashif
Update: September 09, 2013 | Rating: 4.5

Comment for "Stored Procedure Transformations In Informatica"

1 comments:

Blog Archive