I'm having - as it seems - exactly the same issue. Some details:
Java: 8
Oracle JDBC Driver 8: 19.3.0.0
My Sequence looks like:
Increment By 1
Last Cached Value 100100541
Minimum Value 0
Maximum Value 999999999999999999999999999
Cache Size 20
Cycle No
Order No
Keep No
Scale No
Extend No
Session/Global Global
Sharded No
I'm inserting ~33k records in batches into my Oracle DB. Most of the records work fine (~33'500) and some (~7'200) return a very large negative number (such as -449800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
).
The database contains the right values generated.
My code looks (roughly for simplification) like this:
try (PreparedStatement ps = connection.prepareStatement(INSERT_STMT, GENERATED_COLUMN_INDEXES)){
// initialize data per prepared statement
for(...){
ps.setString(...);...
preparedStatement.addBatch();
}
preparedStatement.executeBatch();
ResultSet generatedKeys = ps.getGeneratedKeys()) {
if (generatedKeys.next()) {
BigDecimal generatedKey = generatedKeys.getBigDecimal(GENERATED_COLUMN_INDEX);
...
}
}
Any thought on how to fix this?
Thanks so much!