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

Home -> Community -> Usenet -> c.d.o.tools -> Re: MULT() instead of SUM()

Re: MULT() instead of SUM()

From: Frans Hovenkamp <Dieze_at_popin.nl>
Date: Fri, 17 Nov 2000 08:50:55 +0100
Message-ID: <8v2nom$6s1$1@porthos.nl.uu.net>

gaussent <gaussent_at_dase.bruyeres.cea.fr> wrote in message news:3A13FE6D.9B75CEA5_at_dase.bruyeres.cea.fr...
> Hi,
>
> I'm Chris from France.
> I would like to simulate an aggregate function which multiply instead
> off add.
> I would like to use it in query
>
> A function like SUM() which could be called MULT()
>
> SELECT NAME, MULT(QTY)
> FROM TABLE
> GROUP BY NAME
>
> Give me the result QTY * QTY * .... * QTY for each name.
>
> Is it possible and how can I do this.
>
> Thank you for your help.
>
> Christophe...
>

Hi Christophe,
use logarithms (in the old days before calculaters were found out people use logarithms to multiply big numbers by adding the logarithms) to mulitpy:

select exp(sum(some_number))
from
(
select ln(8) "some_number"
from dual
union
select ln(5) from dual
)

to divide:
select exp(sum(some_numberl))
 from
(
select ln(8) "some_number"
from dual
union
select -ln(5) from dual
) Received on Fri Nov 17 2000 - 01:50:55 CST

Original text of this message

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