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 seeking explanation of SQLException error message
Date Wed, 23 Oct 2013 17:48:01 GMT
hi

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

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

// and now delete this record.............

s.setCursorName("MYCURSOR");
rs = s.executeQuery("SELECT * from USD_JPY WHERE Date = Date2 AND Time =
Time2 FOR UPDATE");
rs.next();
conn.prepareStatement("DELETE FROM USD_JPY WHERE CURRENT OF
MYCURSOR").executeUpdate();

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

and the following log.............

2013-10-23 17:30:55	Message: Column 'DATE2' is either not in any table in
the FROM list or appears within a join specification and is outside the
scope of the join specification or appears in a HAVING clause and is not in
the GROUP BY list. If this is a CREATE or ALTER TABLE  statement then
'DATE2' is not a column in the target table.
2013-10-23 17:30:55	Error Code: 20000
2013-10-23 17:30:55	SQL State: 42X04
2013-10-23 17:30:55	----- SQLException -----
2013-10-23 17:30:55	Date/Time: 01-01-2010, 0

Can somebody throw some light on what the problem might be ?

Bob M 



--
View this message in context: http://apache-database.10148.n7.nabble.com/seeking-explanation-of-SQLException-error-message-tp135002.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Mime
View raw message