如何在 jdbc 中检索 record%type 的表。当我运行java代码时,我收到ORA-04043:对象“PERSON_TB”不存在。
包编译成功:
CREATE OR REPLACE PACKAGE MYPKG AS
TYPE personrec IS RECORD(
id VARCHAR2(10));
type_person_rec personrec;
TYPE person_tb IS TABLE OF type_person_rec%TYPE;
PROCEDURE callproc(persondata OUT person_tb);
END MYPKG;
/
CREATE OR REPLACE PACKAGE BODY MYPKG AS
PROCEDURE callproc(persondata OUT person_tb) AS
lv_persondata person_tb;
BEGIN
lv_persondata(1).id := '123';
persondata := lv_persondata;
lv_persondata.DELETE;
END callproc;
END MYPKG;
下面是获取参数的java代码:
String sql = "{call mypkg.callproc(?)}";
stmt = conn.prepareCall(sql);
stmt.registerOutParameter(1, java.sql.Types.ARRAY,"PERSON_TB");
stmt.execute();
catspeake
相关分类