存储过程
Procedure Update_Batch_Id(p_entity_id in Number, p_vdr_id In fnd_table_of_number) is begin For i In 1 .. p_vdr_id.COUNT Loop update cux_table_header cvs set cvs.attribute10 = p_entity_id where cvs.header_id = p_vdr_id(i); End Loop; end;
JAVA中调用
List list = new ArrayList(); ... list.add(row.getHeaderId()); ...
OracleCallableStatement statement = null;
OracleConnection oracleConnection = (OracleConnection)tsn.getJdbcConnection();
int size = list.size();
if (size>0) { Number[] vdrIdArray = (Number[])list.toArray(new Number[size]); ARRAY vdrArray=null; try { ArrayDescriptor tableOfNumber = oracle.sql.ArrayDescriptor.createDescriptor("FND_TABLE_OF_NUMBER", oracleConnection); vdrArray = new ARRAY(tableOfNumber, oracleConnection, vdrIdArray); String sql = "BEGIN cux_XXXXXXX_pkg.Update_Batch_Id(:1,:2);end;"; statement = (OracleCallableStatement)oracleConnection.prepareCall(sql); statement.setObject(1, batchid); statement.setARRAY(2, vdrArray); statement.execute(); }catch (Exception ex) { String[][] stra2 = { { "123456wewee", ex.getMessage() }, }; LogUtil.of(stra2, this).print(pageContext); ex.printStackTrace(); System.out.println(ex.getMessage()); } }