On 29/01/2015 20:10, Bob M wrote:
Hi
I now have the following code but NO update takes place???
psUpdate = conn.prepareStatement("update TABLE SET PROFIT_LOSS=? WHERE
PROFIT_LOSS=?);
...which suggests that you have no rows whose PROFIT_LOSS column matches the
value of the second parameter.
You should probably use FOR UPDATE in the original SELECT:
// retrieve newest record from the table
rs = s.executeQuery("SELECT * FROM TABLE ORDER BY Trading_Date DESC,"
+ " Trading_Time DESC FETCH FIRST ROW ONLY "
+ "FOR UPDATE OF profit_loss"); //added
rs.next();
// and now update the Profit/Loss field.............
rs.moveToCurrentRow(); //changed
rs.updateDouble("profit_loss",profit); //changed
rs.updateRow(); //changed
... or something similar (this was written off the top of my head, not tested).
--
John English