String updateSql = "UPDATE AMF " +
" SET BLOCKED_CV = ?, " +
" BLOCKED_FC = ? " +
" WHERE BRANCH_CODE = ? " +
" AND CURRENCY_CODE = ? " +
" AND GL_CODE = ? " +
" AND CIF_SUB_NO = ? " +
" AND SL_NO = ? ";
statement = conn.prepareStatement(updateSql);
if (totalColumns > 0) {
//Now writing records in csv file
for (int r = 0; r < totalRows; r++) {
rowVector = (Vector) IADataVector.get(r);
// only update those blocked amounts which exists on imal side
if (rowVector.get(INDEX_PIBAS_ADDREF) != null &&
rowVector.get(INDEX_IMAL_ADDREF) != null) {
//System.out.println("updateRows= " + updateRows);
blockAmount = new Double(rowVector.get(INDEX_PIBAS_SHDWBALN).toString()).doubleValue();
branch = new Integer(rowVector.get(INDEX_IMAL_BRANCH).toString()).intValue();
currency = new Integer(rowVector.get(INDEX_IMAL_CURRENCY).toString()).intValue();
glCode = new Long(rowVector.get(INDEX_IMAL_GL).toString()).longValue();
cifNo = new Long(rowVector.get(INDEX_IMAL_CIF).toString()).longValue();
slNO = new Integer(rowVector.get(INDEX_IMAL_SL).toString()).intValue();
if (currency == 586) {
statement.setDouble(1, blockAmount);
statement.setLong(2, 0);
} else {
statement.setLong(1, 0);
statement.setDouble(2, blockAmount);
}
statement.setInt(3, branch);
statement.setInt(4, currency);
statement.setLong(5, glCode);
statement.setLong(6, cifNo);
statement.setInt(7, slNO);
statement.addBatch();
}
updateRows++;
}
statement.executeBatch();
}
statement.close();
conn.commit();
|