如何使用jdbc调用存储过程,其中IN参数是包含包含xmltype的结构的嵌套表?
例如,下面使用瘦驱动程序调用p_my_package.insert_proc的jdbc代码是什么,xml数据可能大于4000个字符?
CREATE OR REPLACE TYPE ot_config_info
AS
OBJECT
(
config_id VARCHAR2(512),
config_xml sys.xmltype );
CREATE OR REPLACE type tt_config_list
AS
TABLE OF ot_config_info;
CREATE OR REPLACE
PACKAGE p_my_package
IS
PROCEDURE insert_proc(
p_config_list tt_config_list);
END p_my_package;
答案 0 :(得分:0)
stmt = conn.createStatement();
String insertQuery =“INSERT INTO TABLENAME(ID,NAME,STUDENTXML)”+ “VALUES(?,?,XMLTYPE(?))”;
pStmt =(OraclePreparedStatement)conn.prepareStatement(insertQuery); pStmt.setObject(1,“001”); pStmt.setObject(2,“VIGILANCE”); pStmt.setStringForClob(3,“studentXMLString”);
pStmt.executeUpdate();
使用ojdbc14.jar,从here
下载