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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL recursive multiply

Re: SQL recursive multiply

From: Mike Burden <michael.burden_at_capgemini.co.uk>
Date: Fri, 29 Jan 1999 16:07:23 +0000
Message-ID: <36B1DCBA.F522D80E@capgemini.co.uk>

  1. Use exp(sum(ln(qte)))
  2. You can use prior in a start with/connect to retrieve the value of the parent row.

e.g. prior qte * qte

although this does not quite answer you question because the rule changes depending on the level according to your example. You could use decode to return the appropriate value depending on the current level.

Why do you want to do this? It's not just a test is it.

james_at_france-mail.com wrote:

> Hi,
>
> Let s assume, I have the following table :
>
> PID ID QTE
> --- -- ---
> 10 20 3
> 20 31 2
> 20 32 3
> 10 21 2
> 21 33 5
> 10 23 1
>
> The first question is : how to multiply the QTE column, the same
> way I can do a simple sum(QTE), to get : 3*2*3*2*5*1=180
>
> The second question is : if I consider the following three build
> with a "start with/connect by" function where PID=parent Identifier
> and ID=Identifier, how can I recursivly multiply the quantities (QTE)
> to get the quantity I need for each lowest level :
>
> 10
> 20
> 31 (3*2=6)
> 32 (3*3=9)
> 21
> 33 (2*5=10)
> 23 (1=1)
>
> Regards, Remy James.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Received on Fri Jan 29 1999 - 10:07:23 CST

Original text of this message

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