You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Bob M <rg...@orcon.net.nz> on 2015/02/11 06:46:01 UTC

Updating a couple of records - errors still!

Hi John

I added the Update clause and got an error
I removed it and got an error re MovetoCurrentRow
I just can't seem to get the correct sequence of code :(
*****************************************
//if we have two records to update
// i.e. the penultimate record which was closed at the last 6-hour point
// and the ultimate record which was opened at the same time and has since
closed
if ((two_time) && (!initialize) && (myCanTrade) && (myCurrPositionValue >0))
{
// retrieve the last two records
   rs = s.executeQuery("SELECT * FROM TABLE ORDER BY Trading_Date ASC,"
        + " Trading_Time ASC OFFSET x ROWS FETCH NEXT 2 ROWS ONLY");
rs.next();
rs.moveToCurrentRow();
rs.updateDouble("PROFIT_LOSS", prev_profit);
rs.updateRow();
prev_profit = 0;
//move on to the last record
rs.next();
rs.moveToCurrentRow();
rs.updateDouble("PROFIT_LOSS", profit);
rs.updateRow();
two_time =false;
} // end of updating the last two records
*************************************

Bob M




--
View this message in context: http://apache-database.10148.n7.nabble.com/Updating-a-couple-of-records-errors-still-tp143778.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.