PL/SQL:错误"PLS-00306:调用中的参数数目或类型错误".触发数字表 [英] PL/SQL: Error "PLS-00306: wrong number or types of arguments in call to" triggered for table of numbers
问题描述
我正在尝试使用确切的过程签名来调用API,但是以某种方式我认为不正确的数字表可以正确识别.
I'm trying to call an API using the exact procedure signature, but somehow the table of numbers I don't think is recognize correctly.
API定义:
TYPE NUMLIST IS TABLE OF NUMBER INDEX BY VARCHAR2(50);
PROCEDURE GETSERVICES_API
(
I_DIMOBJID IN NUMBER, I_OBJECTID IN NUMBER, I_FILTER IN NUMBER,
O_ERRORCODE OUT NUMBER, O_ERRORTEXT OUT VARCHAR2, O_SERVICELIST OUT NUMLIST
);
我对API的调用
DECLARE
TYPE NUMLIST IS TABLE OF NUMBER INDEX BY VARCHAR2(50);
lt_SERVICELIST NUMLIST;
ls_errortext varchar2(100);
ln_errorcode number;
BEGIN
PKGCOMSUPPORT_SERVICE.GETSERVICES_API(I_DIMOBJID => 6,
I_OBJECTID => 5263,
I_FILTER => 3,
O_ERRORCODE => ln_errorcode,
O_ERRORTEXT => ls_errortext,
O_SERVICELIST => lt_SERVICELIST);
END;
当我运行API调用时,我得到:PLS-00306:调用'GETSERVICE_API
When I run my call of API I got: PLS-00306: wrong number of types of arguments in call to 'GETSERVICE_API
知道为什么吗?谢谢
推荐答案
遇到PLS-00306
错误的原因是包装说明中定义的NUMLIST
集合类型与NUMLIST
集合类型不兼容.匿名PL/SQL块.即使这两个集合类型的定义相同,但它们不兼容.在您的匿名PL/SQL块中,您必须声明然后将PKGCOMSUPPORT_SERVICE.NUMLIST
数据类型的变量传递给GETSERVICES_API
过程.
The reason why you are facing the PLS-00306
error is incompatibility of NUMLIST
collection type, defined in the package specification and NUMLIST
collection type defined in the anonymous PL/SQL block. Even though definitions of those two collection types are the same, they are not compatible. In your anonymous PL/SQL block you have to declare and then pass into the GETSERVICES_API
procedure a variable of PKGCOMSUPPORT_SERVICE.NUMLIST
data type.
create or replace package PKG as
type t_numlist is table of number index by varchar2(50);
procedure SomeProc(p_var in pkg.t_numlist);
end;
/
create or replace package body PKG as
procedure someproc(p_var in pkg.t_numlist) is
begin
null;
end;
end;
/
declare
type t_numlist is table of number index by varchar2(50);
l_var t_numlist;
begin
pkg.someproc(l_var);
end;
ORA-06550: line 5, column 3:
PLS-00306: wrong number or types of arguments in call to 'SOMEPROC'
declare
--type t_numlist is table of number index by varchar2(50);
l_var pkg.t_numlist;
begin
pkg.someproc(l_var);
end;
anonymous block completed
这篇关于PL/SQL:错误"PLS-00306:调用中的参数数目或类型错误".触发数字表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!