导出大数据方法。批量导BOM
create table CUX_IMPORT_DATA_E45 as
select * from CUX_IMPORT_DATA_L11
where 1>2;
CREATE TABLE CUX.lmh_segment1_E41 AS
SELECT * FROM CUX.lmh_segment1_L11
WHERE 1>2;
CUX.lmh_segment1_E41
CREATE TABLE CUX_IMPORT_DATA_E41 AS
SELECT * FROM CUX_IMPORT_DATA_L11
WHERE 1>2
DELETE FROM CUX_IMPORT_DATA_E41;
插入表中
INSERT INTO CUX_IMPORT_DATA_E41(A,ID)
select BBO.BILL_SEQUENCE_ID,rownum
from BOM_BILL_OF_MATERIALS BBO,
mtl_system_items_b msi
where bbo.ORGANIZATION_ID = msi.ORGANIZATION_ID
and bbo.ASSEMBLY_ITEM_ID = msi.inventory_item_id
and msi.ORGANIZATION_ID = 140
and msi.inventory_item_status_code='Active'
AND BBO.BILL_SEQUENCE_ID=664146
;
SELECT *
--DELETE
FROM CUX_IMPORT_DATA_E41;
分组
UPDATE CUX_IMPORT_DATA_E41 SET B = ROUND(ID/100);
/* select * from CUX.lmh_segment1_L11*/
BOM_BILL_OF_MATERIALS_200113;
CREATE TABLE BOM_BILL_OF_MATERIALS_20200401 AS
SELECT bbo.* FROM BOM_BILL_OF_MATERIALS bbo,
mtl_system_items_b msi
where bbo.ORGANIZATION_ID = msi.ORGANIZATION_ID
and bbo.ASSEMBLY_ITEM_ID = msi.inventory_item_id
and msi.ORGANIZATION_ID = 140
and msi.inventory_item_status_code='Active';
-- AND BBO.BILL_SEQUENCE_ID=664146
SELECT * FROM CUX.lmh_segment1_E41;
DELETE FROM CUX.lmh_segment1_E41;
DECLARE
CURSOR bom_cur IS
SELECT B FROM CUX_IMPORT_DATA_E41
group by B ;
BEGIN
FOR L_BOM IN bom_cur LOOP
insert into CUX.lmh_segment1_E41
select
TO_CHAR(msi.segment1) segment1,
TO_CHAR(msii.segment1) segment2,
bic.COMPONENT_QUANTITY,
cux_html_BOM_report.getSubStr(bic.COMPONENT_SEQUENCE_ID,140) sub_item,
cux_html_BOM_report.getdescStr2(bic.COMPONENT_SEQUENCE_ID) descstr,
cux_html_BOM_report.getRevisionStr(bbo.ASSEMBLY_ITEM_ID,140) REVISION,
bbo.attribute10
from BOM_BILL_OF_MATERIALS BBO,--20200401 BBO,
bom_inventory_components BIC,
mtl_system_items_b msi,
mtl_system_items_b msii
where BBO.BILL_SEQUENCE_ID = BIC.BILL_SEQUENCE_ID
and bbo.ORGANIZATION_ID = msi.ORGANIZATION_ID
and bbo.ASSEMBLY_ITEM_ID = msi.inventory_item_id
and bic.COMPONENT_ITEM_ID = msii.inventory_item_id
and bbo.ORGANIZATION_ID = 140
and msii.ORGANIZATION_ID = 140
AND msi.ORGANIZATION_ID = 140
and msii.inventory_item_status_code='Active'
and nvl(bic.DISABLE_DATE,sysdate+1)>sysdate
AND BBO.BILL_SEQUENCE_ID--=664146
in (SELECT A FROM CUX_IMPORT_DATA_E41 WHERE B = L_BOM.B);
END LOOP;
COMMIT;
END;
select segment1 ,segment2,component_quantity,sub_item , TO_CHAR(descstr ) A,revision ,attribute10 from CUX.lmh_segment1_E41