create 执行存储过程报错出现符号_oracle存储过程编译错误:PLS-00103: 出现符号 "end-of-file"在需要下列之一时...

CREATEORREPLACEPROCEDUREUNFOLD_STANDBOM_FINAL_SEQ(CODEVARCHAR2,GROSS_TYPEVARCHAR2,--'N'表示使用净耗;'G'表示使用总耗COMPANYvarchar2)ASCURSOREXPORTCURSORisSELECTITEM,SUM(Q...

CREATE OR REPLACE PROCEDURE UNFOLD_STANDBOM_FINAL_SEQ(

CODE VARCHAR2,

GROSS_TYPE VARCHAR2,--'N'表示使用净耗;'G'表示使用总耗

COMPANY varchar2)

AS

CURSOR EXPORTCURSOR is SELECT ITEM,SUM(QTY),bom_ver FROM CC_FINAL

where code=CODE and company=COMPANY

and bom_ver is not null and bom_ver<>'' GROUP BY ITEM,bom_ver;

-- 展BOM数

ITEM VARCHAR2(64);

ITEM_QTY NUMBER(18,8);

bom_ver VARCHAR2(64);

rec_EXPORTCURSOR EXPORTCURSOR%rowtype;

BEGIN

execute immediate 'CREATE TABLE TEMPPROCESS

(

CODE VARCHAR2(64) , --核销代码,

ITEM_CODE VARCHAR2(64) , --成品料号

APPLY_QTY NUMBER(18,8) , --需展BOM数量

ITEM_CODE_D VARCHAR2(64) , --展后料号

GROSS_QTY NUMBER(18,8) , --展后用量

STEP VARCHAR2(10) , --第几阶

PROCESS VARCHAR2(4000), --展BOM过程

ITEM_CLASS VARCHAR2(1) , --父阶料号属性

ITEM_D_CLASS VARCHAR2(1) --子阶料号属性

)';

--删除旧的展BOM数据

DELETE FROM CC_RESULT_STAND_BOM_FINAL WHERE CODE=CODE and company=COMPANY;

FOR rec_EXPORTCURSOR in EXPORTCURSOR loop -- 需展BOM资料的游标

--展BOM

DECLARE S INT;

begin

if GROSS_TYPE='N'--使用净耗计算

then

S:=1;

--PRINT '成品:'+ITEMCODE

INSERT into TEMPPROCESS SELECT CODE,ITEM,ITEM_QTY,ITEM_D,SUM(NET_QTY*ITEM_QTY),S,

ITEM|| '◇'|| to_char(ITEM_QTY) || '→' ||

ITEM_D || '◇' ||to_char(SUM(NET_QTY*ITEM_QTY)),ITEM_CLASS,ITEM_D_CLASS

FROM CC_STAND_BOM

WHERE ITEM =ITEM

AND CODE=CODE

AND bom_ver=bom_ver

and company=COMPANY

GROUP BY ITEM,ITEM_D,ITEM_CLASS,ITEM_D_CLASS;

-- PRINT 'OUTER '+ITEM

--SELECT * FROM #TEMPPROCESS

elsif GROSS_TYPE='G'--使用总耗计算

then

S:=1;

--PRINT '成品:'+ITEMCODE

INSERT into TEMPPROCESS SELECT CODE,ITEM,ITEM_QTY,ITEM_D,SUM(total_qty*ITEM_QTY),S,

ITEM|| '◇'|| to_char(ITEM_QTY) || '→' ||

ITEM_D || '◇' +to_char(SUM(total_qty*ITEM_QTY)),ITEM_CLASS,ITEM_D_CLASS

FROM CC_STAND_BOM

WHERE ITEM =ITEM

AND CODE=CODE

AND bom_ver=bom_ver

and company=COMPANY

GROUP BY ITEM,ITEM_D,ITEM_CLASS,ITEM_D_CLASS;

INSERT into CC_RESULT_STAND_BOM_FINAL (CODE,PROCESS,ITEM,ITEM_D,ITEM_QTY,ITEM_D_QTY,ITEM_CLASS,ITEM_D_CLASS,company)

SELECT CODE,PROCESS,T.ITEM_CODE,T.ITEM_CODE_D,T.APPLY_QTY,T.GROSS_QTY ,T.ITEM_CLASS,T.ITEM_D_CLASS,COMPANY

FROM TEMPPROCESS T;

INSERT into CC_RESULT_STAND_BOM_FINAL (CODE,PROCESS,ITEM,ITEM_D,ITEM_QTY,ITEM_D_QTY,ITEM_CLASS,ITEM_D_CLASS,company)

SELECT CODE,'',ITEM,ITEM,QTY,QTY,'F','M',COMPANY

FROM CC_FINAL

where code=CODE

and company=COMPANY

and (bom_ver is null or bom_ver='');

END if;

COMMIT;

end;

END loop;

请高手帮忙解决下,我得瑟所有存储过程最后都是报这个错误。。。

展开

你可能感兴趣的:(create,执行存储过程报错出现符号)