Group by in ODI
Hi ,
How to implement Aggreagtor transformation on ODI.
I want use group by on particular column.
Regards,
Srinivas
ODI will generate group by clause as and when you use any aggrigation in your mapping .
Group by clause will be applied on all columns which are part of select /having clause but no aggrigation applied on them .
Suppose you want to select maximun salary per deptno then you need to put MAX(SAL) and you need to select DEPTNO as well .
Odi will generate code like
select deptno,max(sal) from <table_name> group by deptno
Similar Messages
-
how to use GROUP BY in ODI tool
Hi ,
you can combine the insert stamt with the select ....so that in the target u will get a single line .....
SQL> select * from prop_details;
PROPERTY RELAVANTD NOTICES
10100 25-JAN-09 30
10100 03-JAN-09 30
10100 02-DEC-08 20
10100 01-DEC-08 10
10100 31-DEC-08 20
10101 10-JAN-09 10
10101 20-JAN-07 15
10101 30-DEC-08 45
10101 20-FEB-08 35
10101 31-JAN-09 25
10 rows selected.
SQL> select PROPERTY,max(RELAVANTDATE),SUM(NOTICES) from PROP_DETAILS GROUP BY P
ROPERTY;
PROPERTY MAX(RELAV SUM(NOTICES)
10101 31-JAN-09 130
10100 25-JAN-09 110
SQL> -
Example of how group by on ODI
I already post a question on that subject but i didn't succeed to create so if anyone have a example or a tutoriel.
I explain my case :
I have a table with a field containing a bank account, another field containing the amount of an operation on this account. I want to make a sum of operations by account. The request will be something like :
Select SUM(operation),account of TableLedger group by account.
Thanks.Hi,
If you use the SUM function on the target mapping (operation) then the query that ODI generates will automatically contain a group by.
Cheers
John
http://john-goodwin.blogspot.com/ -
Hi,
I have to implement aggreagation trasnformation in ODI...
here is my requirement.
Source(Oracle Table)
C1-C2-C3-C4-C5-C6-C7-C8 (columns)
A B C 4 5 Q1 X Y
A B C 9 8 Q2 X Y
A B C 5 4 Q2 Z Y
A B C 1 2 Q1 Z Y
Should load into target column as:
A B C 4 5 Q1 X Y
A B C 9 8 Q2 X Y
GROUP BY COLUMNS: C1,C2,C3
Aggregate function: FIRST(C4) , FIRST(C5) when C6 = Q1 or Q2
Hope it is clear.
regardsI guess, in that case, he needs to use distinct rows. For a large table, there may be performance issues.
For those group functions that ODI can not recognize, I have following solution:
1. Duplicate your IKM (most likely the standard ones). Modify the step where I$ table is inserted into. Remove these two lines
<%=odiRef.getGrpBy()%>
<%=odiRef.getHaving()%>
and put this:
<% out.print("GROUP BY " + odiRef.getColList("", "[EXPRESSION]", ",", "", "UD1")); %>
2. For C1, C2, C3 mark them as UD1 in addition to marking them INSERT/UPDATE.
3. Write first function based expressions for other columns. Make sure all expressions are executed on staging.
Use the new IKM and run the interface. Let us know how it goes. -
Options Complex Aggregate in ODI interface
I have one source and i need a one target aggregate table.
I have implemented the next sample query:
SELECT
ATRIBUTE1,
ATRIBUTE2,
ATRIBUTE3,
SUM(ATRIBUTE4),
SUM(ATRIBUTE5),
AVG(SUM(ATRIBUTE4+ATRIBUTE5)/ATRIBUTE6),
FROM TABLE_AGG
GROUP BY SUBSTR(ATRIBUTE1,0,6),ATRIBUTE2,ATRIBUTE3
¿Options to implement this query or similar please?
ThanksHave you looked at this thread?
how to use GROUP BY in ODI
Just add the SUM operator to the required target fields in your ODI interface and the GROUP BY clause will be added automatically by ODI. I note that you have a group by field that doesn't exist in your select list - was this deliberate? -
Hi,
friends i completed ODI training and i know SQLPLSQL and OBIEE 10G
can i expect more calls on ODI,how is market for odi present,please share
your valuable suggessions
thanks
rajuHi,
ODI is part of the Oracle statement of direction for data integration. There is more and more ODI opportunities on the market. OWB (former Oracle ETL tool) is no longer developped and I think support will end in 2015 so I guess a lot a company will need to migrate from OWB to ODI.
I suggest you to join the LinkedIn groups related to ODI to find some opportunities. You might also want to try OBIEE 11g because there is a huge gap between 10g and 11g.
Hope it helps.
Regards,
JeromeFr -
Concatenating multiple rows into Single Row
Hi Experts,
I have got a new challenge in my project, but i am not aware of that one, please help me...
i have a source like this
col1 col2
1 a
1 b
1 c
my target would be like this
col1 col2
1 a,b,c
i know how to achieve this in SQL( using LISTAGG( ) or wmconcat( ) ), BUT........
how i can load this into ODI Target table, pleae explain in detail ..
Cheers
VenkatHi,
You should be able to map your LISTAGG function on the target datastore as Col2, if you get in problems with group by , try this trick to supress the group by from ODI :
http://www.business-intelligence-quotient.com/?p=905 -
How to set a group by clause in ODI interface?
How to set a group by clause in ODI interface?
In ODI, group by method will be triggered automatically when any one of your mapping contains aggregate functions.
Thanks,
Saravanan Rajavel -
ODI not writing group by function for xmlagg
Hi all
i have a requirement to create xml file the query is in the target columns are follows
first column deptno
second column xmlserialize(content
xmlagg(xmlelement("emp", xmlattributes(empno as "id", ename AS "name" )
)) as nclob indent
i expect the out put query as
select deptno
, xmlserialize(content
xmlagg(
xmlelement("emp",
xmlattributes(empno as "id", ename as "name")
as clob indent
from scott.emp
group by deptno ;but ODI is not writing group by for xmlagg instead the code generated is
select deptno
, xmlserialize(content
xmlagg(
xmlelement("emp",
xmlattributes(empno as "id", ename as "name")
as clob indent
from scott.emp;can any one help me how to put group by for the column. it should automatically write group by for aggregate columns like max min. not in case of xmlagg.Hi
changed my Ikm settings
<%=odiRef.getGrpBy()%>
replaced with
<% out.print("GROUP BY " + odiRef.getColList("", "[EXPRESSION]", ",", "", "UD1")); %>
marked deptno as UD1 and insert/update and it worked.... -
Error encountered while assigning a value to a variable in ODI.
we are getting the below error while trying to assign the o/p of the below query to a variable in ODI.THis error is encountered when the Table1 is empty....
select b.res from (select (select CEIL((select count(1) from Table1)/2) - #SMARTS.loop_variable from dual) result from dual) a, (select CEIL((select count(1) from cst_dsa.m_pb_cable_data)/2) res from dual) b where a.result >= 0
java.lang.Exception: Error: No value to affect to this variable for DefDate:2012-05-22 13:57:07.0
DefN:null
DefV:null
IndStore:H
ITxtDefT:null
ITxtVar:null
SessNo:800100
VarDatatype:N
VarName:SMARTS.total_loop_count_cable
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.execStdOrders(SnpSessTaskSqlV.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTaskTrt(SnpSessTaskSqlV.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTask(SnpSessTaskSqlV.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
can somebody pls let me know ,how to handle this exception..This error means that there is no value to assign to your variable, because specified query doesn't return result row. You should rewrite your query to guarantee that it would return row in any case.
For example, select nvl(min(b.res), -1) from (select (select CEIL((select count(1) from Table1)/2) - #SMARTS.loop_variable from dual) result from dual) a, (select CEIL((select count(1) from cst_dsa.m_pb_cable_data)/2) res from dual) b where a.result >= 0 group by a,b
Edited by: apiminov on 15.06.2012 8:18
Edited by: apiminov on 15.06.2012 8:19 -
Help using oracle syntax "SUM(col1) over (order by col2)" using ODI
Hi all
I want to load data from oracle to ESSBASE using ODI, and I know oracle have such syntax sum(col1) over (order by col2,col3) which can get the accumulation data, e.g
Oracle data table
col1, col2, value
A 2009-1 10
A 2009-2 10
A 2009-3 10
And the essbase need
col1 col2 value
A 2009-1 10
A 2009-2 20
A 2009-3 30
However after i try this in ODI, error occur:
org.apache.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "<string>", line 32, in ?
java.sql.SQLException: ORA-00979: not a GROUP BY expression
and the original generated SQl by ODI :
select 'HSP_InputValue' "HSP_Rates",MAP_KMDZ_TABLE.BUD_DYKM "Account",MAP_MONTH.ESS_MONTH "Period",MAP_YEAR.ESS_YEAR "Year",'Actual' "Scenario",'Draft' "Version",TEMP_LIRUN.CURRENCY "Currency",MAP_COMPANYCODE.ESS_COMPCODE "Entity",substr(MAP_KMDZ_TABLE.BUD_BUSINESSOBJECT,1,80) "BusinessObject",'Route_NoRoute' "Route",MAP_TRANSPORT.ESS_TRANSPORT "Transport",substr(MAP_KMDZ_TABLE.BUD_BUSINESSACTIVITY,1,80) "BusinessActivity",substr(MAP_KMDZ_TABLE.BUD_CHANNEL,1,80) "Source",'NoCounterparty' "Counterparty",sum(TEMP_LIRUN.DATAVALUE) over (order by MAP_KMDZ_TABLE.BUD_DYKM,MAP_YEAR.ESS_YEAR,MAP_MONTH.ESS_MONTH,TEMP_LIRUN.CURRENCY,MAP_COMPANYCODE.ESS_COMPCODE,MAP_TRANSPORT.ESS_TRANSPORT,MAP_KMDZ_TABLE.BUD_BUSINESSACTIVITY,MAP_KMDZ_TABLE.BUD_BUSINESSOBJECT,MAP_KMDZ_TABLE.BUD_CHANNEL) "Data" from ETL_DEV.TEMP_LIRUN TEMP_LIRUN, ETL_DEV.MAP_KMDZ_TABLE MAP_KMDZ_TABLE, ETL_DEV.MAP_MONTH MAP_MONTH, ETL_DEV.MAP_YEAR MAP_YEAR, ETL_DEV.MAP_COMPANYCODE MAP_COMPANYCODE, ETL_DEV.MAP_TRANSPORT MAP_TRANSPORT where (1=1) And (TEMP_LIRUN.COSTELMNT=MAP_KMDZ_TABLE.SAP_ZZKM)
AND (TEMP_LIRUN.FISCYEAR=MAP_YEAR.SAP_YEAR)
AND (TEMP_LIRUN.FISCPER3=MAP_MONTH.SAP_MONTH)
AND (TEMP_LIRUN.COMP_CODE=MAP_COMPANYCODE.SAP_COMPCODE)
AND (TEMP_LIRUN.WWHC=MAP_TRANSPORT.SAP_WWHC) Group By MAP_KMDZ_TABLE.BUD_DYKM,
MAP_MONTH.ESS_MONTH,
MAP_YEAR.ESS_YEAR,
TEMP_LIRUN.CURRENCY,
MAP_COMPANYCODE.ESS_COMPCODE,
substr(MAP_KMDZ_TABLE.BUD_BUSINESSOBJECT,1,80),
MAP_TRANSPORT.ESS_TRANSPORT,
substr(MAP_KMDZ_TABLE.BUD_BUSINESSACTIVITY,1,80),
substr(MAP_KMDZ_TABLE.BUD_CHANNEL,1,80)
I know ODI think sum.. over must append group by , however it's not! How to solve this problem.
Thank All for your attention
SOS!
EthanHi Ethan,
In my exeprnc I faced a similar kind of situation.
Two work arounds.
1. Write one procedure and execute the same using ODI procedure.
2. Customize a Km and use that KM in your interface.
I guess in your query Group by function is not needed. (if this is the case you can achive this by a smple customization step in KM)
for example : your current KM will generate a query like this:-
select x,y, sum(x) over (order by y) as sumx FROM TestTable group by x, y
and you need a query like this
select x,y, sum(x) over (order by y) as sumx FROM TestTable
go to your KM (duplicate the KM which you are using and rename _withoutGroup )
remove the group by function from select query
(remove the API function <%=snpRef.getGrpBy()%> from insert into i$ table step)
please let me know if you need more help on this
regards,
Rathish -
How to lock data independently for several groups in Hyperion Planning?
I 'm developing a forecast application using Hyperion Planning 9.3.1 where the users shall be able to enter their monthly forecast numbers. We have two groups of users. Each group may have up to two forecast updates per month. The groups are independent – say, Group A may have one update for August and they want the numbers to be there by August 10th, while the Group B may have two updates for the same month with the first update to be completed by July 20th and second – by August 5th. Nobody knows in advance how many updates they are going to have for the month and when they are going to have them. Nothing should prohibit the users from updating their forecast numbers for the future months – say, they may enter their September forecast in July.
Managers of both groups want to make sure that users don't change forecast numbers after the month close. If they plan to have two updates per month – they want data from the 1st update to be locked (become read-only) before they have 2nd update, and data from 2nd update locked after the month close; if they plan to have only one update per month – they want it locked after the month close.
Any suggestions how I may structure the dimensions of this application to make sure that if I lock first August update for Group B on, say, August 3rd, the other group still can have it open until August 10th?
Thanks!Hi John
Well i have working knowledge in ODI, i did whole complete cycle and i did customization project for Oracle EBS to Data warehouse though ODI.
What, I am NOT able to figure out How to LINK Hyperion Planning Outline to Oracle EBS HR Tables. cause in Hyperion Outline i m able to view Dimensions Not particular Column to map with EBS HR Table (column).
Eample:
In EBS HR we have Employee Number in Per_all_people_f but in Hyperion Planning Dimension is ONLY Employee.
Your response highly appreciated.
Chreeez
Sher -
How to avoid Sequence Gapping in ODI Interface
I have an employee table and a job map table in oracle based on the employee type/group and job type/group I need to pick up the sequence, generate id
and update employee id of employee table using ODI
employee table job table
name type group id type group sequencename seqmin seqmax
pat 1 1 1 1 seq1 1 10
dan 1 2 1 2 seq2 30 40
john 1 3 1 3 seq3 20 100
when I select the sequence using if condition or case statement or decode and call the sequence <%=snpRef.getObjectName( "L" , "My_SEQ" , "D" )%>.nextval
the sequences are creating gaps for every call.as the sequence is incrementing internally for every wrong mapping. How should I get rid of these gaps.
In oracle database we call functions in the case condition.These functions consists of the seq.nextval code and the unwanted incremental gapping is avoided.
But in the case of ODI how can we get this.
Thanks,
VikramI am facing this issue when I execute on the source or staging area.When I try toexecute on the target,the ODI
doesn't allow me to execute and gives the following warning
"A mapping executed on the target cannot reference source columns. Move this mapping on the source or the staging area. Target Column Employeeid"
In my case I am using IKM Oracle Incremental update
the source datastore is employee table, job table and target is copy of employee table(as i need to update the employee id column with sequence numbers by picking the right sequence from job table,sequence name column) -
I Have the following interface in oracle data integrator
http://i44.tinypic.com/2mrsmxt.png
# it execute successfully before inserting the following expression
In the mapping I insert the following SQL expression to get the average when the quantity is 0
AVG(
CASE WHEN TEST.QUN = 0 THEN
(SELECT TEST.QUN FROM TEST
WHERE TEST1.PRUDU=TEST.PRUDU
AND TEST1.FLOW=TEST.UNIT
AND TEST1.UNIT=TEST.UNIT
AND to_char(TEST.DATEDDD,'MON')= to_char(TEST1.DATEDDD,'MON')
AND TEST1.DATEDDD !=TEST.DATEDDD
GROUP BY TEST.QUN
ELSE TEST.QUN
END)
when I check this expression in ODI ..
# the sql expression is correct for this RDMS
when I executed the interface i get this error
Caused By: java.sql.SQLSyntaxErrorException: ORA-00937: not a single-group group function
any idea ?I changed the code a little ..
CASE WHEN TEST.QUN = 0 THEN
(SELECT AVG(TEST.QUN) FROM TEST
WHERE TEST1.PRUDU=TEST.PRUDU
AND TEST1.FLOW=TEST.FLOW
AND TEST1.UNIT=TEST.UNIT
AND to_char(TEST.DATEDDD,'MON')= to_char(TEST1.DATEDDD,'MON')
AND to_char(TEST.DATEDDD,'YYYY')!= to_char(TEST1.DATEDDD,'YYYY')
ELSE TEST.QUN
END
And I get this error ..
ORA-01427: single-row subquery returns more than one row tips.
The TEST Table from the source and TEST1 is a lookup table because I couldn't do the alais in ODI
In sql developer I did the following code that will do the same thing and work successfully ..
update test B
set B.qun=
(SELECT AVG(TEST.QUN) FROM TEST
WHERE TEST.FLOW=B.UNIT
AND TEST.UNIT=B.UNIT
AND TEST.PRUDU=b.prudu
AND TEST.FLOW=b.flow
AND to_char(TEST.DATEDDD,'MON')= to_char(B.DATEDDD,'MON')
AND to_char(TEST.DATEDDD,'YYYY')!= to_char(B.DATEDDD,'YYYY')
where B.qun=0;
any help ?
thanksssss
naif .. -
Group Account Configuration - OBIA 11.1.1.7.1
Hello,
I am setting up Financial Analytics OBIA 11.1.1.7.1, have following questions regarding group account code setup
1. Should we always use Natural Account Segment for mapping to Group Account Codes? I could see a customer is using different segment (Sub Account) to classify their accounts to various categories. Should we use combination of Natural Account and Sub Account to classify them in to various Oracle supplied group account numbers?
2.If i have to go with multiple segments for group account configuration, i could n't see a technical note from oracle support for OBIA 11.1.1.7.1 where ETL tool is ODI. Can we customize ODI using the technote available for Informatica based OBIA 7964 tech note? Are there any changes to apply on top of it?
Thanks
Venkat GHi,
Thanks for reply. We've multiple COAs(Three Companies with seperate COA) Also with in one COA natural Account is dependend on Sub GL Segment and Cost Center. In "file_group_acct_codes_ora" file we only map Natural Accounts.Now if we map only Natural Accounts to Group Account Number it will pull all data. e.g. Natural Account 123,Cost Center A and Sub GL Account 1 should be mapped to Cash. if we map 123 to Cash it will pull all data for all Sub GL Accounts and Cost Centers. Please let me know if you need more clarification.
Regards
mzai
Maybe you are looking for
-
Windows 7 64-Bit cannot install itunes 32-bit or 64-bit
Hello, I have a Windows 7 Home premium 64-Bit laptop. I downloaded the 64-bit version of itunes. When I attempt to install, I received a message that states that the version of the file is not compatible with the version of windows I'm running. I
-
Firefox does not seem to give me this option.
-
Help on right mouse click in swing GUI.
I am working on a swing GUI interface which has Panels. One Panel contains two sub panels. I want to add the Right Mouse click feature to the panels. How should i go about achieving this? Please provide sample example if any. Thanks in advance.
-
Unable to run deployed aplication on IAS 10.1.3
Hello I have an application that I developed and tested in JDeveloper 10.1.3.2. When I deploy the application on my 10.1.3 application server server I get an error message like java.lang.NoSuchMethodError: oracle.adf.share.perf.StateTracker.isActive(
-
Transport Request Implementation Log
Hi Gurus, I have a Transport Request implemented in the production server. I want to know by whom that TR was implemented. It's one of my TR and I know all the attributes related to it. Only thing I want to know is who has implemented that TR in prod