I am familiar with the CONNECT BY ... PRIOR function and have used it to get a multi-level Product Structure (i.e Bill-of-Material) with code such as:
SELECT level, a.part_no, a.component_part, a.qty_per_assembly
FROM manuf_structure a
CONNECT BY PRIOR a.component_part = a.part_no
START WITH a.part_no = '&part_no'
That is ok, and shows me the Qty_per_Assembly of each component used within its immediate parent. But what I really want is to see the cumulative qty_per_assembly, for example:
P is parent of Q (Qty_per_assembly of Q in P is 2)
Q is parent of R (Qty_per_assembly of R in Q is 5)
R is parent of S (Qty_per_assembly of S in R is 3.5)
then I want to see:
How do you do this WITHOUT using PL/SQL or creating a new function?
SELECT level, a.part_no, a.component_part, a.qty_per_assembly
FROM manuf_structure a
CONNECT BY PRIOR a.component_part = a.part_no
START WITH a.part_no = '&part_no'
That is ok, and shows me the Qty_per_Assembly of each component used within its immediate parent. But what I really want is to see the cumulative qty_per_assembly, for example:
P is parent of Q (Qty_per_assembly of Q in P is 2)
Q is parent of R (Qty_per_assembly of R in Q is 5)
R is parent of S (Qty_per_assembly of S in R is 3.5)
then I want to see:
Code:
[i]level Part Qty_per Cumulative_Qty_Per[/i]
1 P 1 1
2 Q 2 2
3 R 5 10 (2*5)
4 S 3.5 35 (2*5*3.5)