Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: "PRODUCT()" aggregate function

Re: "PRODUCT()" aggregate function

From: Maxim Demenko <mdemenko_at_arcor.de>
Date: Fri, 16 Sep 2005 11:45:12 +0200
Message-ID: <432a9441$0$27548$9b4e6d93@newsread4.arcor-online.net>


lawk schrieb:
> Hi,
>
> I work for an bank and runs an in-house system that calculates
> portfolio performance.
>
> There is an upstream system that calculates daily performance. My
> system takes these daily performance, and sequentially multiplies them
> to arrive at, say, the 3M moving window performance.
>
> This results in having to loop thru EVERY SINGLE daily performance row,
> which obviously does not scale well.
>
> Is there a function (or a commercial PKG) that has an aggregate
> function that calculates the PRODUCT of a certain col, via a GROUP BY
> clause?
>
> Thks...
> L
>

There is an aggregate function sum(), as well as single row functions exp() and ln().
In pseudocode : product() = exp(sum(ln())), you must ensure to take ln() from a value > 0 (i.e. if value equals to 0 then product equeals to 0, if value less than 0, then you should calculate with abs(value)).

Best regards

Maxim Received on Fri Sep 16 2005 - 04:45:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US