如何使用Java将ID和值数组作为参数输入到存储过程

时间:2017-06-23 12:26:03

标签: java stored-procedures procedure callable-statement

我需要输入 ID 数组(其为NUMERIC类型)和(其为VARCHAR2类型) 参数到存储过程。结构如下:

TYPE plan_dtl AS OBJECT(
p_id NUMERIC,
p_value VARCHAR2
);
TYPE plan_tbl AS TABLE OF plan_dtl;
PROCEDURE sp_update(p_name IN OUT VARCHAR2, p_array IN pk_manage.plan_tbl);

有谁能告诉我如何使用java设置位置2的值数组?

CallableStatement cs = conn.prepareCall("{call package_name.sp_update(?,?)}");  
cs.registerOutParameter(1,Types.CHAR);
cs.setString(1, "some name");  
cs.setArray(2, "how to pass it here ?")

示例输入将类似于

id(NUMERIC)值(VARCHAR2)

[{88627,"02"},{88671,"01"},{88644,"05"}]

所有这些值都应作为数组传递给位置2的可调用语句

0 个答案:

没有答案