11

我正在尝试使用确切的过程签名调用 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 时参数类型错误的数量

知道为什么吗?谢谢

4

4 回答 4

11

您面临PLS-00306错误的原因是NUMLIST集合类型不兼容,在包规范中NUMLIST定义和在匿名 PL/SQL 块中定义的集合类型。尽管这两种集合类型的定义相同,但它们并不兼容。在您的匿名 PL/SQL 块中,您必须声明一个数据类型GETSERVICES_API的变量, 然后将其传递给该过程。PKGCOMSUPPORT_SERVICE.NUMLIST

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
于 2013-10-23T14:56:03.243 回答
0

我认为类型定义无效。要创建表“类型”,您需要以下内容:

CREATE OR REPLACE TYPE NUMLIST AS OBJECT (COLUMN1 VARCHAR2(50));
于 2013-10-23T14:25:48.703 回答
0

也许你可以试试这个:

CREATE TYPE NUMLIST AS TABLE OF NUMBER INDEX BY VARCHAR2(50);

DECLARE

   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;
于 2013-10-23T14:53:49.027 回答
0

我也有 PLS-00306 错误,但原因不同。就我而言,我使用了错误的参数名称。我有程序:FUNCTION get_card_list(p_clob_in IN CLOB, o_clob_out OUT CLOB)

参数名称是p_clob_ino_clob_out,所以我应该调用这个过程:get_card_list(p_clob_in=>inner, o_clob_out=>outer) or get_card_list(inner, outer),但我使用了错误的参数名称:p_xml & o_xmlget_card_list(p_xml=>inner, o_xml=>outer)

这段 YT 视频对我有很大帮助:https ://www.youtube.com/watch?v=xwMVL3Z_vn8

于 2019-03-07T13:48:50.327 回答