c++oracleocci

OCI-22303: type ""."VARCHAR2_5_TYPE" not found


C++ code as below:

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 script as below:

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;
/

But when I run the program and call the OCCI function to put the data array into Oracle db, error prompt as below: OCI-22303: type ""."VARCHAR2_5_TYPE" not found

How can I fix this issue, many thanks.


Solution

  • You need to create the type outside the package as:

    create or replace TYPE varchar2_5_type is table of varchar2(5);