Oracle 10g and SQLPlus
I have customer orders with multiple lines of Part A – a top level assembly.
The user enters the customer order # and I’m using CONNECT_BY_PRIOR to pull a simple indented bill of material for Part A and finding the total qty needed of each part based on the sales qty.
SELECT
lpad(' ',3*(level-1))||LEVEL AS indented,
m.component_part, (m.qty_per_assembly * c.qty) AS qty_per_assembly,
FROM manuf_structure m, cust_ord_qty c
WHERE alternative_no = '*'
AND c.order_no = ‘&ENTER_ORDER_NO’
CONNECT BY PRIOR m.component_part = m.part_no
AND PRIOR m.contract = m.contract
AND m.eff_phase_in_date<= SYSDATE
START WITH m.part_no = c.part_no
AND m.eff_phase_in_date <= SYSDATE
AND nvl(m.eff_phase_out_date, SYSDATE) >= SYSDATE
This works fine but I may have 2 different sales parts on the same order - A & B.
I need to loop through this for each part found in cust_ord_qty. I think I need to loop through this but everything I've tried fails.
select order_no, count(part_no) AS LOOP_QTY
from ifsinfo.cust_ord_qty
where order _no = ‘&ENTER_ORDER_NO’
group by order_no;
How can I do this an get all of the lines to output to file?
I have customer orders with multiple lines of Part A – a top level assembly.
The user enters the customer order # and I’m using CONNECT_BY_PRIOR to pull a simple indented bill of material for Part A and finding the total qty needed of each part based on the sales qty.
SELECT
lpad(' ',3*(level-1))||LEVEL AS indented,
m.component_part, (m.qty_per_assembly * c.qty) AS qty_per_assembly,
FROM manuf_structure m, cust_ord_qty c
WHERE alternative_no = '*'
AND c.order_no = ‘&ENTER_ORDER_NO’
CONNECT BY PRIOR m.component_part = m.part_no
AND PRIOR m.contract = m.contract
AND m.eff_phase_in_date<= SYSDATE
START WITH m.part_no = c.part_no
AND m.eff_phase_in_date <= SYSDATE
AND nvl(m.eff_phase_out_date, SYSDATE) >= SYSDATE
This works fine but I may have 2 different sales parts on the same order - A & B.
I need to loop through this for each part found in cust_ord_qty. I think I need to loop through this but everything I've tried fails.
select order_no, count(part_no) AS LOOP_QTY
from ifsinfo.cust_ord_qty
where order _no = ‘&ENTER_ORDER_NO’
group by order_no;
How can I do this an get all of the lines to output to file?