I have a basic requirement. We use the jdbc driver to connect to Oracle 11 Database.
We use the PreparedStament, to execute multiple statements in batches.
Following is the typical code snippet used:
PreparedStatement stmt = connection.prepareStatement(SQL);
for (ObjEntry param : rows) {
stmt.setLong(IDX_TIME, param.getStartTime());
stmt.setLong(IDX_BYTES, param.getBytes());
stmt.setLong(IDX_ID, param.getDbId());
stmt.addBatch();
}
stmt.executeBatch();
I know that the Batch will execute the commands, in the same order as that added to the Batch using the stmt.addBatch call.
However, I need the statements to be ordered in ascending order, based on the value of one of the fields,
say IDX_ID.
Is that possible?