Sunday, November 15, 2015

UNPIVOT ODI 12C

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!!!!

2 comments:

  1. There is no pivot or un_pivot component in component panel in ODI12C

    ReplyDelete
    Replies
    1. ODI 12.1.3 version onward you can see these components. Earlier versions you can't find it out.

      Delete