finance_teacher
asked on
Oracle 10G -- PL/SQL INSERT STATEMENT (Loop) ?
Below works good for part_no = '305'
How can i get it working for all 800+ parts ?
========================== ========== ========== ========== ========== ========== ====
--truncate table condition_code_sale_price_ tab;
insert into condition_code_sale_price_ tab
select 'N' CONDITION_CODE, 'PVL' CONTRACT, ipis.part_no CATALOG_NO, ROUND(ipis.total_COST/ipis .total_qty *scmt.mark up,2) PRICE, 'USD' CURRENCY_CODE, SYSDATE ROWVERSION
from
(
select part_no, SUM(qty_onhand) total_qty,
sum(qty_onhand * decode(inventory_part_stoc k_owner_ap i.get_part _ownership _db(contra ct, part_no, location_no), 'COMPANY OWNED',
inventory_part_unit_cost_a pi.get_inv entory_val ue_by_meth od(contrac t, part_no, configuration_id, lot_batch_no, serial_no), 0)) TOTAL_COST
from inventory_part_in_stock
where
part_no = '305' and
CONTRACT = 'PVL' AND
condition_code_manager_api .get_condi tion_code (part_no,serial_no,lot_bat ch_no ) = 'N' and
qty_onhand - qty_reserved > 0 and
decode(inventory_part_stoc k_owner_ap i.get_part _ownership _db(contra ct, part_no, location_no), 'COMPANY OWNED',
inventory_part_unit_cost_a pi.get_inv entory_val ue_by_meth od(contrac t, part_no, configuration_id, lot_batch_no, serial_no), 0) > 0.01
group by part_no
) ipis
inner join inventory_part_tab ipt
on ipis.part_no = ipt.part_no
inner join sab_commodity_markup_tab scmt
on scmt.commodity = ipt.PRIME_COMMODITY
--SELECT * from condition_code_sale_price_ tab
How can i get it working for all 800+ parts ?
==========================
--truncate table condition_code_sale_price_
insert into condition_code_sale_price_
select 'N' CONDITION_CODE, 'PVL' CONTRACT, ipis.part_no CATALOG_NO, ROUND(ipis.total_COST/ipis
from
(
select part_no, SUM(qty_onhand) total_qty,
sum(qty_onhand * decode(inventory_part_stoc
inventory_part_unit_cost_a
from inventory_part_in_stock
where
part_no = '305' and
CONTRACT = 'PVL' AND
condition_code_manager_api
qty_onhand - qty_reserved > 0 and
decode(inventory_part_stoc
inventory_part_unit_cost_a
group by part_no
) ipis
inner join inventory_part_tab ipt
on ipis.part_no = ipt.part_no
inner join sab_commodity_markup_tab scmt
on scmt.commodity = ipt.PRIME_COMMODITY
--SELECT * from condition_code_sale_price_
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I tried to put rec.part_no in bold face but the editor made it rec.part_no so ignore those. rest is fine.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Where are the 800+ part_no's? If they are all of the part_no's in the inventory_part_in_stock, then just remove the condition part_no = '305'.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, I will test.