I have an application which reads data from excel and write it into Oracle DB using Spring BatchSqlUpdate class. The values are getting properly inserted for most of the cases but for some rare cases i am getting below issues.
In Spring sql types for one of my column teh type configured as 'BigDecimal', so i will convert the values read from excel to Bigdecimal. I am trying to convert '24445720' to BigDecimal and the result is '2.444572E+7'. I am passing the same value to the update command but the value got inserted as '2444572' the last 0 got truncated.
Code:
BigDecimal.valueOf (((Number) value).doubleValue ()); //convert value
//Code used for insert data
BatchSqlUpdate upd = createBatchUpdate ();
for (BillEvent event : events) {
Object params[] = getInsertParamsForEvent (event);
upd.update (params);
}
upd.flush ();
private BatchSqlUpdate createBatchUpdate () {
BatchSqlUpdate upd = new BatchSqlUpdate (ds, insEvent.getSql (),
insEventTypes);
upd.compile ();
upd.setBatchSize (100);
upd.setTrackRowsAffected (false);
return upd;
}
Please help