Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Problem converting sybase view to oracle
I have been converting a sybase database to oracle and I am having problems
with this view and others similar.
However my oracle version does not work as I get an error saying 'case when sum(quantity)' is not a group by expression any help in how I could make this work would be most welcome.
THE ORIGINAL SYBASE VIEW:
product, if MAX(price) is null then 0 else MAX(Price) endif, sum(v_DeliveredProducts.quantity)- (select(if sum(quantity) is null then 0 else sum(quantity) endif) from dba.v_invoicelist where v_invoicelist.product = v_DeliveredProducts.product and v_invoicelist.caseid = v_deliveredProducts.caseID), MAX(datedelivered)
datedelivered >= effectivefrom and(datedelivered <= effectiveto or
effectiveto is null)
group by product,caseID
BELOW IS THE ORACLE VERSION I AM WORKING ON:
product, case when MAX(price) is null then 0 else MAX(Price) end, sum(v_DeliveredProducts.quantity)- (select(case when sum(quantity) is null then 0 else sum(quantity) end) from cme.v_invoicelist where v_invoicelist.product = v_DeliveredProducts.product and v_invoicelist.caseid = v_deliveredProducts.caseID), MAX(datedelivered)
v_DeliveredProducts.product = v_productlist.productid(+) and
datedelivered >= effectivefrom and
(datedelivered <= effectiveto or effectiveto is null)
group by product,caseID
;
Received on Mon Aug 20 2001 - 03:13:22 CDT