Hi
I have the following code where I am trying to update a record
[code]
// update penultimate record by adding the four new fields - p0, result0,
p1, result1
// retrieve the penultimate record from Hourly_History table and output date
and time
rs = s.executeQuery ("SELECT * FROM HOURLY_HISTORY ORDER BY TRADING_DATE
DESC,"
+ " TRADING_TIME DESC OFFSET 1 ROW FETCH NEXT 1 ROW ONLY");
rs.next();
Date_temp = rs.getString("Trading_Date");
Time_temp = rs.getInt("Trading_time");
s.setCursorName("MYCURSOR");
myConsole.getOut().println("Penultimate record in table HOURLY_HISTORY: " +
Date_temp + "," + Time_temp);
rs = s.executeQuery("SELECT p0 FROM HOURLY_HISTORY WHERE TRADING_DATE =
Date_temp AND TRADING_TIME = Time_temp FOR UPDATE");
rs.next();
psUpdate = conn.prepareStatement("UPDATE HOURLY_HISTORY SET p0 = ?, result0
= ?, p1 = ?, result1 = ? WHERE CURRENT OF MYCURSOR");
statements.add(psUpdate);
psUpdate.setDouble(1, p0);
psUpdate.setBoolean(2, result0);
psUpdate.setDouble(3, p1);
psUpdate.setBoolean(4, result1);
psUpdate.executeUpdate();
myConsole.getOut().println("Updated penultimate record in table
HOURLY_HISTORY: ");
fw.writetoFile(("Updated penultimate record with p0, result0, p1 &
result1"), File_Name);
// commit the above transactions
conn.commit();
// end of updating the penultimate record
[/code]
It would appear that the program is faultering during this code
Is there any obvious mistakes ?
Bob M
--
Sent from:
http://apache-database.10148.n7.nabble.com/Apache-Derby-Users-f95095.html