甲骨文程序 ORA-06550,PLS_00103



我有一个过程定义为:

PROCEDURE Import_Invoice 
(     as_Directory_Name_Invoice_Data in varchar2,
as_File_Name_Invoice_Data in varchar2,
as_Directory_Name_Invoice_Log in varchar2,
al_processid out number, 
al_errnum out number,
as_errstr out varchar2 ) IS
begin
al_processid := 123;
al_errnum := 2;
as_errstr := 'sfs';
end;

当我从 shell 脚本执行该过程时,如下所示:

#! /bin/ksh
::::::::::::
OUTVAL=`sqlplus -s usr/passwd@ora_instance <<EOF
264 whenever sqlerror exit failure rollback
265 set pagesize 0
266 set feed off
267 set echo off
268 set serveroutput on
269 DECLARE
270 var al_errnum number,
271 var as_errstr varchar2,
272 var al_processid number,
273 BEGIN
274 execute Import_Invoice('INVOICE_INBOUND_DAT_DIR','INVOICE_apvend_daily.dat','INVOICE_INBOUND_LOG_DIR', al_processid, al_errnum, as_errstr );
275 END
276 /
277 EOF`
::::::

OUTVAL返回为:

OUTVAL=var al_errnum number, CAMS_INVOICE_20180802_120830.DAT INVOICE_apvend_daily.dat ERROR at line 2: ORA-06550: line 2, column 15: PLS-00103: Encountered the symbol "NUMBER" when expecting one of the following: := . ( @ % ; not null range default character

我找不到问题所在。

感谢您的建议。

更新:按照@dandarc建议,我将调用代码更改为:

OUTVAL=`sqlplus -s usr/passwd@ora_instance <<EOF
whenever sqlerror exit failure rollback
set pagesize 0
set feed off
set echo off
set serveroutput on
var al_errnum number
var as_errstr varchar2(1000)
var al_processid number
BEGIN
execute Import_Invoice('INVOICE_INBOUND_DAT_DIR','INVOICE_apvend_daily.dat','INVOICE_INBOUND_LOG_DIR', :al_processid, :al_errnum, :as_errstr );
END
/
EOF`

我收到此错误:

OUTVAL=execute Import_Invoice('INVOICE_INBOUND_DAT_DIR','INVOICE_apvend_daily.dat','INVOICE_INBOUND_LOG_DIR', :al_processid, :al_errnum, :as_errstr ); CAMS_INVOICE_20180802_120830.DAT INVOICE_apvend_daily.dat ERROR at line 2: ORA-06550: line 2, column 9: PLS-00103: Encountered the symbol "IMPORT_INVOICE" when expecting one of the following: := . ( @ % ; immediate The symbol ":=" was substituted for "IMPORT_INVOICE" to continue. ORA-06550: line 3, column 3: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ; <an identifier> <a double-quoted delimited-identifier> The symbol ";" was substituted for "end-of-file" to continue.

请帮忙。

在脚本声明部分中:

269 DECLARE
270 var al_errnum number,
271 var as_errstr varchar2,
272 var al_processid number,

应该是:

269 DECLARE
270  al_errnum number;
271  as_errstr varchar2;
272  al_processid number;

PL/SQL不需要var,每一行都应该以分号结尾。

这将清除错误,但您可能需要一个如下所示的脚本:

#! /bin/ksh
::::::::::::
OUTVAL=`sqlplus -s usr/passwd@ora_instance <<EOF
whenever sqlerror exit failure rollback
set pagesize 0
set feed off
set echo off
set serveroutput on
var al_errnum number
var as_errstr varchar2(20)
var al_processid number
BEGIN
Import_Invoice('INVOICE_INBOUND_DAT_DIR','INVOICE_apvend_daily.dat','INVOICE_INBOUND_LOG_DIR', :al_processid, :al_errnum, :as_errstr );
275 END
276 /
277 EOF`
::::::

声明 sqlplus 变量,然后将这些变量传递给您的过程。据推测,您稍后会在脚本中检查这些变量。

相关内容

  • 没有找到相关文章

最新更新