I have a larger Select
statement which works fine until I include the following which returns the below error.
Using just the Sum
part works too but I only need this for the first row of each AID which is why I used the Row Number here.
Can someone tell me what I am doing wrong here ?
Is the problem maybe that Sum and Partition are referring to two different tables which I am joining in the Select ?
My SQL (part of Select):
, CASE
WHEN ROW_NUMBER() OVER (PARTITION BY dp.SHIPPER_ID ORDER BY di.AID) = 1 THEN (SUM(di.SHIPPED_UNITS) OVER (PARTITION BY dp.SHIPPER_ID))
ELSE ''
END AS Gesamtmenge
Error message:
ORA-00932: inconsistent datatypes: expected NUMBER got CHAR
Many thanks in advance for any help,
Mike