db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob M <rgmatth...@orcon.net.nz>
Subject deleting a record - still a problem
Date Wed, 23 Oct 2013 03:44:22 GMT
Hi there

The error is that my SELECT can not have "For UPDATE" ????

My current code is
***************************
// retrieve and output date and time of oldest record from the table
rs = s.executeQuery("SELECT * FROM tablename ORDER BY Date ASC, Time ASC
FETCH FIRST ROW ONLY");
rs.next();
String Date2 = rs.getString("Date");
String Time2 = rs.getString("Time");

myConsole.getOut().println("Date/Time: " + Date2 + ", " + Time2);

// and now delete this record.............
s.setCursorName("MYCURSOR");
rs = s.executeQuery("SELECT * FROM tablename ORDER BY Date ASC, Time ASC
FETCH FIRST ROW ONLY FOR UPDATE");
rs.next();

psDelete = conn.prepareStatement("DELETE FROM tablename WHERE CURRENT OF
MYCURSOR");
statements.add(psDelete);

myConsole.getOut().println("Deleted oldest record");



--
View this message in context: http://apache-database.10148.n7.nabble.com/deleting-a-record-still-a-problem-tp134975.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Mime
View raw message