当前位置: 首页 > 工具软件 > D.eval > 使用案例 >

dbms_aw.eval_number

上官斌
2023-12-01

INSERT INTO bom
SELECT 'A','B',3 FROM dual UNION ALL
SELECT 'A','C',2 FROM dual UNION ALL
SELECT 'A','D',4 FROM dual UNION ALL
SELECT 'B','E',2 FROM dual UNION ALL
SELECT 'B','F',3 FROM dual UNION ALL
SELECT 'D','G',6 FROM dual UNION ALL
SELECT 'D','H',5 FROM dual UNION ALL
SELECT 'E','I',3 FROM dual

SELECT part_no,
       qty,
       DBMS_AW.eval_number(substr(sys_connect_by_path(qty, '*'),2)) AS sum_qty
  FROM bom
 START WITH item_no = 'A'
CONNECT BY PRIOR part_no = item_no
ORDER SIBLINGS BY 1,2;

PART_NO           QTY    SUM_QTY
---------- ---------- ----------
B                   3          3
E                   2          6
I                   3         18
F                   3          9
C                   2          2
D                   4          4
G                   6         24
H                   5         20
8 rows selected


SQL> 

 类似资料:

相关阅读

相关文章

相关问答