I am trying to execute the batch query using PreparedStatement.executeBatch() and trying to catch any exception occurred in BatchUpdateException. But I am getting a blank array on calling BatchUpdateException.getUpdateCounts().
Below is my code:
int[] updateCounts = null;
PreparedStatement stmt = null;
// some logic to set the stmt and create the SQL query
try {
if (count % 100 == 0)
{
updateCounts = stmt.executeBatch();
}
} catch (BatchUpdateException bu)
{
updateCounts = bu.getUpdateCounts();
}
Here I get an empty array of updateCounts when an exception occurs... Why?
NOTE:
BatchUpdateException -
SystemErr R java.sql.BatchUpdateException: ORA-01400: cannot insert NULL into ("TABLE_ABC"."AMOUNT")
CSV file from where the code reads the data... expecting error in the 3rd record
Asof_Date,Price_Date,Amount
12/15/2015,11/26/2014,-2646.937686
12/15/2015,11/28/2014,5053.611471
12/15/2015,1/22/2015,
12/15/2015,1/23/2015,
countis 0.