- Drag source and target tables into Mapping Designer.
- Design the mapping as shown below.
- Connect all ports from Source Qualifier transformation to Expression transformation.
- Create an output variable in Expression transformation as shown below:
- o_Sum_Sal = CUME(sal)
- Connect all ports fromm Expression transformation to target.
Showing posts with label Scenarios. Show all posts
Showing posts with label Scenarios. Show all posts
Sunday, July 15, 2012
Findind sum of the salary
Sunday, July 8, 2012
Generating sequence numbers without using Sequence Generator transformation
- Create a target table with a field name SEQ_NO for sequence number.
- Design the Mapping as shown above.
- In the Expression transformation create a variable port and increment it by 1.
- V_Count=V_Count+1
- In the Expression transformation create a output port and assign variable port to it.
- O_Count=V_Count
- Connect O_Count to SEQ_NO.
Monday, May 28, 2012
Finding Maximum value in the column
Description:
My source and target tables as shown below:
Solution:
My source and target tables as shown below:
| MY SOURCE | MY TARGET | |||||||||||||||||||||
|
|
Solution:
- Drag source and taget tables in mapping
- Create an Aggregator t/f and connect all ports from Source Qualifier t/f to Aggregator.
- In Aggregator t/f, create 3 output ports as shown below:
- out_Col1=MAX (Col1)
- out_Col2 = MAX (Col2)
- out_Col3 =MAX (Col3)
- Connect all output ports to target table.
- The mapping pipeline as shown above.
Thursday, May 24, 2012
Join the data of two tables which does not have common columns
Description:
Lets assume I have two source files as shown below:
I would like to load the target a shown below:
Lets assume I have two source files as shown below:
| SOURCE 1 | SOURCE 2 | |||||||||||||||||||||||
|
|
I would like to load the target a shown below:
| SNo | Name | Sal | Location |
|---|---|---|---|
| 100 | Sivan | 2000 | Noida |
| 200 | Uday | 3000 | Banglore |
| 300 | Chandu | 1800 | Hyderabad |
| 400 | Satish | 1500 | Chennai |
Saturday, May 12, 2012
How to return muliple values using Unconnected lookup?
Today we discuss how to return muliple values using Unconnected lookup. First of all, the UnConnected lookup has one return port and returns one column from each row. If the interviewer asked the above scenario, follow the below solution.
- Let us assume EMP will be source table and DEPT will be LOOKUP table.
- Create a target table T_UNCONN_LKP in target designer. Table should contain all ports of EMP table plus DNAME and LOC.
- Go to the Mapping Designer and create the mapping with source, target, lookup and expression transformations as shown below:
Split non-key columns
Description: I have a source table with 3 columns EMPNO, ENAME, LOC. Now I would like to split the source into 2 taget tables based on the primary key EMPNO as one target table contains EMPNO, ENAME and another target table contains EMPNO, LOC as shown below.
| MY SOURCE | TARGET_1 | TARGET_2 | ||||||||||||||||||||||||||||||||||||||||
|
|
|
- Connect all ports from Source transformation to Aggregate transformation.
- Connect EMPNO and ENAME ports to one target table.
- And connect EMPNO and LOC ports to another target table.
- The final mapping looks like as shown below:
Thursday, May 10, 2012
Sending second half records of the table to target
- Drag source and target into the mapping.
- Let us assume EMP is source, and create a new table say T_EMP with same structure as EMP.
- Create the mapping as shown below:
- Now edit Source Qualifier tranformation and click on properties tab.
- Enter the following query in SQL Query property:
- Save the mapping.
- Finally create session, Workflow and run thee workflow.
SELECT * FROM emp MINUS SELECT * FROM emp WHERE ROWNUM <= (SELECT COUNT(*)/2 FROM emp
Sending first half records of the table to target
- Drag source and target into the mapping.
- Let us assume EMP is source, and create a new table say T_EMP with same structure as EMP.
- Create the mapping as shown below:
- Now edit Source Qualifier tranformation and click on properties tab.
- Enter the following query in SQL Query property:
- Save the mapping.
- Finally create session, Workflow and run thee workflow.
SELECT * FROM emp WHERE ROWNUM <= (SELECT COUNT(*)/2 FROM emp
Tuesday, May 8, 2012
Concatinate duplicate values
| MY SOURCE | MY TARGET | |||||||||||||||||||||||||||||||||||
|
|
Solution:
- Here the no. of rows in source and target tables are same; so here we think about Passive transformations.
- After importing Source and Target, create a Sorter transformation to sort the data.
- Then create an Expression transformation with 3 ports named say v_Name, v_SNo (2 variable ports) and o_Name (output port).
- Give the expressions as follows
- v_Name as variable port
- v_SNO as variable port
- o_Name as output port
- The final mapping looks like..
IIF(SNo = v_SNo, v_Name||Name, Name)
SNo
v_Name
- Finally connect the ports to Target, create and execute the session and workflow.
Subscribe to:
Posts (Atom)