自己寫了一個package,在執行的時候出現
Compilation errors for PACKAGE BODY APPS.BOM_MATERIAL_CHECK
Error: PLS-00103: 發現了符號"end-of-file" 當您等待下列事項之一發生時:
begin end function package pragma procedure form
Line: 153(該package得最後一行)
代碼如下:
create or replace package body bom_material_check
is
procedure bom_material_check_p(errbuf out varchar2,retcode out varchar2,
v_pcs_area out number,v_area out NUMBER,
v_pnl_to_pcs out INT )
is
cursor bom_material_disabled_cursor is
select operation_seq_num,
component_item_id,
item_num,
component_quantity,
component_sequence_id,
bill_sequence_id,
ASSEMBLY_ITEM_ID,
segment1,
primary_uom_code
from (select distinct bb.operation_seq_num, bb.component_item_id, bb.component_quantity, bb.item_num,
bb.component_sequence_id,
bb.bill_sequence_id, bbo.ASSEMBLY_ITEM_ID, msi.segment1, msi.primary_uom_code from bom_bill_of_materials bbo,
bom.bom_components_b bb,
bom.bom_operational_routings bo,
bom.bom_operation_sequences bos,
bom.bom_departments bd,
mtl_system_items_b msi
where bo.routing_sequence_id = bos.routing_sequence_id
and bbo.BILL_SEQUENCE_ID = bb.bill_sequence_id
and bbo.ASSEMBLY_ITEM_ID = bo.assembly_item_id
and bbo.ORGANIZATION_ID = bo.organization_id
and bo.assembly_item_id = msi.inventory_item_id
and bd.department_id = bos.department_id
and bb.operation_seq_num = bos.operation_seq_num
and msi.organization_id = 115
and bb.pk2_value = 117
and bbo.ORGANIZATION_ID = 117
and bb.component_item_id in (select msi.inventory_item_id
from mtl_system_items_b msi
where msi.segment1 ='01110010141002' )
and msi.segment1 ='B02CAB4004A20' and bb.disable_date is null
and bd.department_code ='A10' );
errbuf VARCHAR2;
retcode VARCHAR2;
v_pcs_area NUMBER;
v_area NUMBER;
v_pnl_to_pcs INT;
begin
dbms_output.put_line(RPAD('組裝料號', 20) || RPAD('ERP單位', 20) ||
RPAD('變更料號序號', 20) || RPAD('變更的料號ID', 20) ||
RPAD('原單位用量', 20) || RPAD('PCS面積', 20) ||
RPAD('PCS轉化系數', 20) || RPAD('轉化后單位用量', 20)); FOR bom_material_disabled_record in bom_material_disabled_cursor loop
begin
select attrib.area, attrib.pcs_spnl
into v_pcs_area, v_pnl_to_pcs
from XXXXX (另外一個數據庫中的表)
if bom_material_disabled_record.primary_uom_code = 'PCS' then
v_area := v_pcs_area;
else
if bom_material_disabled_record.primary_uom_code = 'PNL' then
v_area := v_pcs_area * v_pnl_to_pcs;
end if;
end if; update bom_components_b
set component_quantity = 0.1 * v_area
where bill_sequence_id =
bom_material_disabled_record.bill_sequence_id
and operation_seq_num =
bom_material_disabled_record.operation_seq_num
and component_sequence_id =
bom_material_disabled_record.component_sequence_id;
dbms_output.put_line(RPAD(bom_material_disabled_record.segment1, 20) ||
RPAD(bom_material_disabled_record.primary_uom_code,
20) || RPAD(bom_material_disabled_record.component_item_id,
20) ||
RPAD(bom_material_disabled_record.item_num, 20) ||
RPAD(bom_material_disabled_record.component_quantity,
20) || RPAD(v_pcs_area, 20) ||
RPAD(v_pnl_to_pcs, 20) ||
RPAD(0.1 * v_area, 20));
exception
when others then
begin
rollback;
retcode := sqlcode;
errbuf := 'ERROR_CODE: update error!' || SQLERRM;
fnd_file.put_line(fnd_file.LOG, retcode || '-' || errbuf);
fnd_file.put_line(fnd_file.output,
rpad(bom_material_disabled_record.bill_sequence_id,
30) || rpad(bom_material_disabled_record.operation_seq_num,
30) ||
rpad(bom_material_disabled_record.component_sequence_id,
30));
end;
end;
commit;
end loop;
end bom_material_check_P;
Compilation errors for PACKAGE BODY APPS.BOM_MATERIAL_CHECK
Error: PLS-00103: 發現了符號"end-of-file" 當您等待下列事項之一發生時:
begin end function package pragma procedure form
Line: 153(該package得最後一行)
代碼如下:
create or replace package body bom_material_check
is
procedure bom_material_check_p(errbuf out varchar2,retcode out varchar2,
v_pcs_area out number,v_area out NUMBER,
v_pnl_to_pcs out INT )
is
cursor bom_material_disabled_cursor is
select operation_seq_num,
component_item_id,
item_num,
component_quantity,
component_sequence_id,
bill_sequence_id,
ASSEMBLY_ITEM_ID,
segment1,
primary_uom_code
from (select distinct bb.operation_seq_num, bb.component_item_id, bb.component_quantity, bb.item_num,
bb.component_sequence_id,
bb.bill_sequence_id, bbo.ASSEMBLY_ITEM_ID, msi.segment1, msi.primary_uom_code from bom_bill_of_materials bbo,
bom.bom_components_b bb,
bom.bom_operational_routings bo,
bom.bom_operation_sequences bos,
bom.bom_departments bd,
mtl_system_items_b msi
where bo.routing_sequence_id = bos.routing_sequence_id
and bbo.BILL_SEQUENCE_ID = bb.bill_sequence_id
and bbo.ASSEMBLY_ITEM_ID = bo.assembly_item_id
and bbo.ORGANIZATION_ID = bo.organization_id
and bo.assembly_item_id = msi.inventory_item_id
and bd.department_id = bos.department_id
and bb.operation_seq_num = bos.operation_seq_num
and msi.organization_id = 115
and bb.pk2_value = 117
and bbo.ORGANIZATION_ID = 117
and bb.component_item_id in (select msi.inventory_item_id
from mtl_system_items_b msi
where msi.segment1 ='01110010141002' )
and msi.segment1 ='B02CAB4004A20' and bb.disable_date is null
and bd.department_code ='A10' );
errbuf VARCHAR2;
retcode VARCHAR2;
v_pcs_area NUMBER;
v_area NUMBER;
v_pnl_to_pcs INT;
begin
dbms_output.put_line(RPAD('組裝料號', 20) || RPAD('ERP單位', 20) ||
RPAD('變更料號序號', 20) || RPAD('變更的料號ID', 20) ||
RPAD('原單位用量', 20) || RPAD('PCS面積', 20) ||
RPAD('PCS轉化系數', 20) || RPAD('轉化后單位用量', 20)); FOR bom_material_disabled_record in bom_material_disabled_cursor loop
begin
select attrib.area, attrib.pcs_spnl
into v_pcs_area, v_pnl_to_pcs
from XXXXX (另外一個數據庫中的表)
if bom_material_disabled_record.primary_uom_code = 'PCS' then
v_area := v_pcs_area;
else
if bom_material_disabled_record.primary_uom_code = 'PNL' then
v_area := v_pcs_area * v_pnl_to_pcs;
end if;
end if; update bom_components_b
set component_quantity = 0.1 * v_area
where bill_sequence_id =
bom_material_disabled_record.bill_sequence_id
and operation_seq_num =
bom_material_disabled_record.operation_seq_num
and component_sequence_id =
bom_material_disabled_record.component_sequence_id;
dbms_output.put_line(RPAD(bom_material_disabled_record.segment1, 20) ||
RPAD(bom_material_disabled_record.primary_uom_code,
20) || RPAD(bom_material_disabled_record.component_item_id,
20) ||
RPAD(bom_material_disabled_record.item_num, 20) ||
RPAD(bom_material_disabled_record.component_quantity,
20) || RPAD(v_pcs_area, 20) ||
RPAD(v_pnl_to_pcs, 20) ||
RPAD(0.1 * v_area, 20));
exception
when others then
begin
rollback;
retcode := sqlcode;
errbuf := 'ERROR_CODE: update error!' || SQLERRM;
fnd_file.put_line(fnd_file.LOG, retcode || '-' || errbuf);
fnd_file.put_line(fnd_file.output,
rpad(bom_material_disabled_record.bill_sequence_id,
30) || rpad(bom_material_disabled_record.operation_seq_num,
30) ||
rpad(bom_material_disabled_record.component_sequence_id,
30));
end;
end;
commit;
end loop;
end bom_material_check_P;
参考下下面的信息吧PLS-00103: %s
Cause: This error message is from the parser. It found a token (language element) that is inappropriate in this context.
Action: Check previous tokens as well as the one given in the error message. The line and column numbers given in the error message refer to the end of the faulty language construct.