使用包体

时间:2016-10-26 05:00:21

标签: sql oracle

我收到以下错误:

  

'ORA-06550:第1行,第48列:PLS-00103:当期待下列之一时遇到符号“,”:: =。 (@%;'

尝试在代码下面运行时

create or replace PACKAGE BODY "PACKAGE_NAME" As

Procedure MAIN Is

BEGIN

LOAD_DATA;

END MAIN;

Procedure LOAD_DATA Is

V_LC_NARRATIVE VARCHAR2(50) :=     
'CDB_LETTER_OF_CREDIT_NARRATIVE.LOAD_DATA';
V_LC_STMT_ENTRY_NO VARCHAR2(50) := 'CDB_LC_STMT_ENTRY_NO.LOAD_DATA';
V_LC_HSCODE VARCHAR2(50) := 'CDB_LETTER_OF_CREDIT_HSCODE.LOAD_DATA';

BEGIN
insert into table_name
(
column1,
column2,...
)
SELECT 
 column1,
 column2,...
FROM Table_2 WHERE ID IS NOT NULL;
COMMIT;

 EXECUTE IMMEDIATE ' BEGIN ' || V_LC_NARRATIVE || ', END,';
 EXECUTE IMMEDIATE ' BEGIN ' || V_LC_STMT_ENTRY_NO || ', END,';
 EXECUTE IMMEDIATE ' BEGIN ' || V_LC_HSCODE || ', END,';

Exception
  WHEN OTHERS THEN
   ERROR_LOGGER ('PACKAGE_NAME', 'TABLE_NAME','',  SQLCODE,   substr(SQLERRM, 1, 500));

 END LOAD_DATA;

 END PACKAGE_NAME;

1 个答案:

答案 0 :(得分:1)

更改这些行:

 execute immediate ' BEGIN ' || v_lc_narrative || ', END,';

 execute immediate ' BEGIN ' || v_lc_narrative || '; END;';