On 10/22/13 10:40 AM, Bob M wrote:
Thanks Rick

Keeping the code 'in sync' is difficult when applying example code :)

Will the following do what I am seeking?

  rs = s.executeQuery("SELECT from tablename ORDER BY Date ASC, Time, ASC
FETCH FIRST ROW ONLY");
rs.next();
String Date = rs.getString("Date");
String Date = rs.getString("Time");
myConsole.getOut().println("Date/Time " + Date ", " + Time);


At this stage , I am successfully printing out the correct record data!

Now I wish to delete this record..........

          conn.setAutoCommit( false );

          s.setCursorName( "MYCURSOR" );
          rs = s.executeQuery( repeat the above...............);
Hi Bob,

The SELECT statement needs to end with the "FOR UPDATE" phrase in order to make the positioned DELETE work.

Hope this helps,
-Rick
          rs.next();

          psDelete = conn.prepareStatement( "DELETE from tablename where
current of
MYCURSOR" );
          statements.add(psDelete);

}

}


p.s.
code further above this lot................

ArrayList statements = new ArrayList();
PreparedStatement psInsert = null;
PreparedStatement psUpdate = null;
PreparedStatement psDelete  = null;
Statement s = null;
ResultSet rs = null;





--
View this message in context: 
http://apache-database.10148.n7.nabble.com/Retrieving-the-oldest-record-and-deleting-it-tp134915p134956.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Reply via email to