--头
DECLARE
l_rowid ROWID;
BEGIN
fnd_lookup_types_pkg.insert_row(x_rowid => l_rowid
,x_lookup_type => 'BHSC_YES_NO' /*类型*/
,x_security_group_id => 0
,x_view_application_id => 3
,x_application_id => 20003 /*应用*/
,x_customization_level => 'U' /*访问级别*/
-- Customization Level
-- U 用户
-- X 可拓展
-- Y 系统
,x_meaning => 'BHSC_YES_NO' /*说明*/
,x_description => '' /*说明*/
,x_creation_date => SYSDATE
,x_created_by => 0
,x_last_update_date => SYSDATE
,x_last_updated_by => 0
,x_last_update_login => 0);
COMMIT;
END;
--行
DECLARE
l_rowid ROWID;
l_description mtl_system_items_b.description%TYPE;
CURSOR cur_1 IS
SELECT ct.item_number,
ct.segment1,
ct.segment2,
ct.segment3,
ct.segment4
FROM cux.cux_use_tbl ct;
BEGIN
FOR cur1 IN cur_1 LOOP
BEGIN
SELECT msi.description
INTO l_description
FROM mtl_system_items_b msi
WHERE msi.organization_id = 1458
AND msi.segment1 = cur1.item_number;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('不存在该物料:' || cur1.item_number);
CONTINUE;
END;
fnd_lookup_values_pkg.insert_row(x_rowid => l_rowid,
x_lookup_type => 'CUX_BOM_ALTERNATE_ITEM_RULE' /*类型*/,
x_view_application_id => 3,
x_lookup_code => cur1.item_number /*代码*/,
x_tag => '',
x_attribute_category => 'CUX_BOM_ALTERNATE_ITEM_RULE',
x_attribute1 => '',
x_attribute2 => '',
x_attribute3 => cur1.segment1,
x_attribute4 => '',
x_enabled_flag => 'Y' /*启用*/,
x_start_date_active => SYSDATE /*有效期自*/,
x_end_date_active => '' /*有效期至*/,
x_territory_code => '',
x_attribute5 => '',
x_attribute6 => '',
x_attribute7 => '',
x_attribute8 => '',
x_attribute9 => '',
x_attribute10 => '',
x_attribute11 => '',
x_attribute12 => '',
x_attribute13 => cur1.segment4,
x_attribute14 => cur1.segment3,
x_attribute15 => cur1.segment2,
x_meaning => cur1.item_number /*含义*/,
x_description => l_description /*说明*/,
x_creation_date => SYSDATE,
x_created_by => 10538,
x_last_update_date => SYSDATE,
x_last_updated_by => 10538,
x_last_update_login => 10538);
COMMIT;
END LOOP;
END;