Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Instead of SUM() I require MULTIPLY
Hello Ethan,
You can sum the logarithms, and then raise the result to the power of e using the exp function. For example, try:
select exp(sum(ln(x))) from test;
It should give you the results you are after.
Best regards,
Jonathan Gennick --- Brighten the corner where you are http://Gennick.com * 906.387.1698 * mailto:jonathan@gennick.com
Friday, December 9, 2005, 5:13:09 PM, Ethan Post (post.ethan_at_gmail.com) wrote: EP> I just came up with a function I would like, but don't think exists.
EP> TABLE TEST (X NUMBER) EP> ===================== EP> 2 EP> 2 EP> 4
EP> select sum(x) from test;
EP> will return 8...
EP> what I need is
EP> select multiply(x) from test;
EP> will return 16, because 2*2*4 is 16.
EP> Anyone ever seen a SQL aggregate function like this? I don't think it exists EP> but I hold out hope.
EP> - Ethan
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Dec 09 2005 - 19:15:31 CST
![]() |
![]() |