Member since
05-31-2019
3
Posts
0
Kudos Received
0
Solutions
06-03-2019
05:48 AM
I agree with you. The stacktrace shows that the sql misses the cast for the second record. Unfortunately I do not have any control on the effective query, since it is done via JDBC. This is a code replicating the issue: String sql = "INSERT INTO ST.X VALUES (?, CAST(? AS DECIMAL(16,2)))";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, id1);
ps.setBigDecimal(2, amount1);
ps.addBatch();
ps.setString(1, id2);
ps.setBigDecimal(2, amount2);
ps.addBatch();
ps.executeBatch();
} When I execute the same code by adding the batch just once, it works correctly. It seems like the driver "cleans up" the query, removing the cast: INSERT INTO ST.X VALUES
('123456789-xyz', CAST(350000 AS DECIMAL(16,2))) ,
('321564987-zyx',7896163500)
... View more