?
Solved

Filter Aggregate Data in Oracle Data Integrator 11g

Posted on 2011-02-25
8
Medium Priority
?
3,241 Views
Last Modified: 2013-12-19
I am having difficulting figuring out Oracle Data Integrator and how to filter an aggregate column,

for example - I am taking data from a source and aggregating it to a target.  Within one of the target fields I would like to filter - here is the scenerio

Source: Table1
order_number
line_item
quantity
unit_price
option

Target: Aggregate_Table_1

total_cost = sum(quantity*unit_price)
total_cost_less_options = sum(quantity*unit_price) where option='N'

I am having difficulting for the mapping for total_cost_less_options in ODI interface, when I create the implementation I am not getting the syntax correct.

Thanks.
0
Comment
Question by:daledog9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34981577
are you aggregating across the entire table or for orders?

updating/inserting int the aggregate table should be straight forward:

select order_number,
   sum(options) over(partition by order_number order by order_number) options_price,
   sum(unit_price) over(partition by order_number order by order_number) total_price
select order_number, case when option='N' then 0 else unit_price end options, unit_price
from table1
)

0
 

Author Comment

by:daledog9
ID: 34983775
I agree, the sql is very straight forward - but I cannot figure out how to use the expression builder in ODI to get my results.  When I run straight SQL I get my desired results, but I keep getting errors when writing the same code the expression builder within ODI.
0
 

Author Comment

by:daledog9
ID: 34983897
to further explain my note above ...
In the mapping view of the Interface for the fields -

Implementation for total_cost field = sum(quantity*unit_price)
No errors

Implementation for total_cost_less_options field = sum(quantity*unit_price) where option='N'
Receive error: java.sql.SQLSyntaxErrorException: ORA-00923: FROM keyword not found where expected

I found under quick edit tab where you can create a filter, but I do not want the entire dataset filtered, just the calculated field of total_cost_less_options
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 34984292
I apologize.  I didn't see the ODI reference when I first read the question.

I've never used the product myself so this is a huge guess but try something like:

total_cost field = sum(case when option = 'N' then quantity*unit_price else 0 end)
0
 

Author Comment

by:daledog9
ID: 34993582
Thank you for adding the additional zones.  The syntax you suggested pass the check, but now it's failing during executing with ORA-00920: invalid relational operator.  It does not seem to be processing the group by properly as it performs that automatically- or rather I am not understanding how ODI works in respect to group by.  
0
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 2000 total points
ID: 34994377
i think a typo here.

select order_number,
   sum(options) over(partition by order_number order by order_number) options_price,
   sum(unit_price) over(partition by order_number order by order_number) total_price
select order_number, case when option='N' then 0 else unit_price end options, unit_price
from table1
)

it should be the below right ?

select order_number,
   sum(options) over(partition by order_number order by order_number) options_price,
   sum(unit_price) over(partition by order_number order by order_number) total_price
from (
select order_number, case when option='N' then 0 else unit_price end options, unit_price
from table1
)
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35242902
daledog9,

Can I ask why I didn't get partial credit?

I gave you everything except I missed "from (".  A pretty simple typo correction nav just beat me to it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question