OCI-22303:未找到类型“”。"VARCHAR2_5_TYPE"
OCI-22303: type ""."VARCHAR2_5_TYPE" not found
C++代码如下:
stmt = con->createStatement("BEGIN ABC.INPUT(:1, :2, :3, :4, :5); END;");
oracle::occi::setVector(stmt, 1, id1, "VARCHAR2_5_TYPE");
oracle::occi::setVector(stmt, 2, id2, "VARCHAR2_5_TYPE");
oracle::occi::setVector(stmt, 3, data, "NUMBER_10_2_TYPE");
oracle::occi::setVector(stmt, 4, time1, "VARCHAR2_16_TYPE");
oracle::occi::setVector(stmt, 5, time2, "VARCHAR2_16_TYPE");
stmt->executeUpdate();
con->commit();
con->terminateStatement(stmt);
Oracle 脚本如下:
CREATE OR REPLACE PACKAGE "ABC" as
TYPE varchar2_5_type is table of varchar2(5) index by PLS_INTEGER;
TYPE number_10_2_type is table of number(10,2) index by PLS_INTEGER;
TYPE varchar2_16_type is table of varchar2(16) index by PLS_INTEGER;
CAL_MSLP PLS_INTEGER := 0;
PROCEDURE INPUT(ID1_ARRAY in varchar2_5_type,ID2_ARRAY in varchar2_5_type,DATA_ARRAY IN OUT NOCOPY number_10_2_type,TIME1_ARRAY in varchar2_16_type,TIME2_ARRAY in varchar2_16_type);
end ABC;
/
CREATE OR REPLACE PACKAGE BODY "ABC" as
PROCEDURE INPUT(ID1_ARRAY in varchar2_5_type,ID2_ARRAY in varchar2_5_type,DATA_ARRAY in OUT NOCOPY number_10_2_type,TIME1_ARRAY in varchar2_16_type,TIME2_ARRAY in varchar2_16_type) is
MSL_VALUE NUMBER(10,2);
BEGIN
......
END INPUT;
END ABC;
/
但是当我运行程序调用OCCI函数将数据数组放入Oracle db时,错误提示如下:
OCI-22303:未找到类型“”。"VARCHAR2_5_TYPE"
我该如何解决这个问题,非常感谢。
您需要在包外创建类型为:
create or replace TYPE varchar2_5_type is table of varchar2(5);
C++代码如下:
stmt = con->createStatement("BEGIN ABC.INPUT(:1, :2, :3, :4, :5); END;");
oracle::occi::setVector(stmt, 1, id1, "VARCHAR2_5_TYPE");
oracle::occi::setVector(stmt, 2, id2, "VARCHAR2_5_TYPE");
oracle::occi::setVector(stmt, 3, data, "NUMBER_10_2_TYPE");
oracle::occi::setVector(stmt, 4, time1, "VARCHAR2_16_TYPE");
oracle::occi::setVector(stmt, 5, time2, "VARCHAR2_16_TYPE");
stmt->executeUpdate();
con->commit();
con->terminateStatement(stmt);
Oracle 脚本如下:
CREATE OR REPLACE PACKAGE "ABC" as
TYPE varchar2_5_type is table of varchar2(5) index by PLS_INTEGER;
TYPE number_10_2_type is table of number(10,2) index by PLS_INTEGER;
TYPE varchar2_16_type is table of varchar2(16) index by PLS_INTEGER;
CAL_MSLP PLS_INTEGER := 0;
PROCEDURE INPUT(ID1_ARRAY in varchar2_5_type,ID2_ARRAY in varchar2_5_type,DATA_ARRAY IN OUT NOCOPY number_10_2_type,TIME1_ARRAY in varchar2_16_type,TIME2_ARRAY in varchar2_16_type);
end ABC;
/
CREATE OR REPLACE PACKAGE BODY "ABC" as
PROCEDURE INPUT(ID1_ARRAY in varchar2_5_type,ID2_ARRAY in varchar2_5_type,DATA_ARRAY in OUT NOCOPY number_10_2_type,TIME1_ARRAY in varchar2_16_type,TIME2_ARRAY in varchar2_16_type) is
MSL_VALUE NUMBER(10,2);
BEGIN
......
END INPUT;
END ABC;
/
但是当我运行程序调用OCCI函数将数据数组放入Oracle db时,错误提示如下: OCI-22303:未找到类型“”。"VARCHAR2_5_TYPE"
我该如何解决这个问题,非常感谢。
您需要在包外创建类型为:
create or replace TYPE varchar2_5_type is table of varchar2(5);