try {
// Create an oracle.sql.ARRAY object to hold the values
oracle.sql.ArrayDescriptor arrayDesc =
oracle.sql.ArrayDescriptor.createDescriptor("number_varray", connection);
int arrayValues[] = {123, 234};
oracle.sql.ARRAY array = new oracle.sql.ARRAY(arrayDesc, connection, arrayValues);
// Create a prepared statement for insertion into varray_table
PreparedStatement ps =
connection.prepareStatement("INSERT INTO varray_table VALUES(?)");
// Set the values to insert
((oracle.jdbc.driver.OraclePreparedStatement)ps).setARRAY(1, array);
// Insert the new row
ps.execute();
} catch (SQLException e) {
}
// Create an oracle.sql.ARRAY object to hold the values
oracle.sql.ArrayDescriptor arrayDesc =
oracle.sql.ArrayDescriptor.createDescriptor("number_varray", connection);
int arrayValues[] = {123, 234};
oracle.sql.ARRAY array = new oracle.sql.ARRAY(arrayDesc, connection, arrayValues);
// Create a prepared statement for insertion into varray_table
PreparedStatement ps =
connection.prepareStatement("INSERT INTO varray_table VALUES(?)");
// Set the values to insert
((oracle.jdbc.driver.OraclePreparedStatement)ps).setARRAY(1, array);
// Insert the new row
ps.execute();
} catch (SQLException e) {
}