is there any way to get the values of affected rows using RETURNING INTO ? I have to insert the same rows x times and get the ids of inserted rows.
The query looks like below:
public static final String QUERY_FOR_SAVE =
"DECLARE " +
" resultId NUMBER ; " +
"BEGIN " +
" INSERT INTO x " +
" (a, b, c, d, e, f, g, h, i, j, k, l, m) " +
" values (sequence.nextVal, :a, :b, :c, :d, :e, :f, :g, :h, :i, :j, :k, :l) " +
" RETURNING a INTO :resultId;" +
"END;";
Now i can add thise query to batch, in JAVA loop using addBatch
IntStream.range(0, count)
.forEach(index -> {
try {
setting parameters...
cs.addBatch();
} catch (SQLException e) {
e.printStackTrace();
}
});
cs.executeBatch();
Is there any way to return an array or list from batch like this ? I can execute those insert x times using just sql but in this case i also wondering how to return an array of ids.
Thanks in advance