对象类型:
CREATE OR REPLACE type cycle_t as object
(
rk NUMBER,
ndt date,
ht varchar2(40),
be number(5),
count number(20),
fy number(2),
bih VARCHAR2(20)
);
收藏类型:
CREATE OR REPLACE type cycle_tab as table of cycle_t;
PACKAGE:
CREATE OR REPLACE PACKAGE shem.Pkg_Bam_rok AS
type cycle_tab is table of cycle_t;
PROCEDURE test_proc(i_cf IN VARCHAR2,
i_acm IN VARCHAR2,
o_res OUT cycle_tab,
o_error_message OUT VARCHAR2);
END Pkg_Bam_rok;
/
BODY:
CREATE OR REPLACE PACKAGE BODY Pkg_Bam_rok AS
procedure test_proc(i_cf IN VARCHAR2,
i_acm IN VARCHAR2,
o_res OUT cycle_tab,
o_error_message OUT VARCHAR2)
is
v_be varchar2(20);
begin
SELECT 2 into v_be from dual;
end test_proc;
end Pkg_Bam_rok;
/
JDBC_CALL:这是我的proc的调用
final String typeName = "cycle_t";
final String typeTableName = "cycle_tab";
// Get a description of your type (Oracle specific)
final StructDescriptor structDescriptor = StructDescriptor.createDescriptor(typeName.toUpperCase(), connection);
final ResultSetMetaData metaData = structDescriptor.getMetaData();
CallableStatement call = connection.prepareCall("{call shem..Pkg_Bam_rok.test_proc(?,?,?,?)}");
call.setString(1,"asd");
call.setString(2,"asd");
call.registerOutParameter(3,Types.ARRAY,typeTableName.toUpperCase());
call.registerOutParameter(4,java.sql.Types.VARCHAR);
call.execute();
PLS:00306:获取错误的参数或输入错误
编辑:我试过普通的proc它可以工作,但是从包中调用它给出错误