UNPIVOT ODI 12C
Scripts:
CREATE TABLE SALES(
YEAR VARCHAR2(4) ,
Q1 NUMBER(10,2) ,
Q2 NUMBER(10,2) ,
Q3 NUMBER(10,2) ,
Q4 NUMBER(10,2) );
/
CREATE TABLE SALES_PER_QUARTER(
YEAR VARCHAR2(4),
QUARTER VARCHAR2(2),
SALES NUMBER(10,2));
/
INSERT INTO SALES
VALUES('2014',23345.32,32456.41,21234.21,18324.12);
INSERT INTO SALES
VALUES('2015',24324.12,34234.51,25345.18,17234.86);
COMMIT;
/
|
Steps:
1.
Create new Mapping
2.
Drag and drop Source datastore and target
datastore
3.
Drag and drop unpivot component from component
palette into Mapping editor
4.
Connect UNPIVOT and target datastore and select
as below screen
5.
Click ok
6.
Now connect source datastore and UNPIVOT
component and deselect the create attributes on Target
7.
Select unpivot component and go to property
inspector (Ctrl+Shift+i)
8.
Select Row Locator as Quarter under – General tab
9.
Click on “+” symbol and add four columns as
below
10.
Execute the mapping
11.
Output:
Completed Successfully!!!!