I use a prepare statement to execute an update statement.
PreparedStatement stmt = null;
stmt = connection.prepareStatement("UPDATE " + table + " SET date = ?, id = ?, n = ? " +
"WHERE (id_v = ?) AND (id_vid = ?)");
stmt.setDate(1, n.getDate());
stmt.setInt(2, n.getId());
stmt.setInt(3, n.getN());
stmt.setInt(4, n.getId_v());
stmt.setInt(5, n.getId_vid());
stmt.executeUpdate();
stmt.close();
but I get an exception java.sql.SQLException: ORA-00920: invalid relational operator
What’s wrong with my code?
p.s table is string parametre that I pass through the method
edit
The problem was resolved by using simple Statement(but not PrepareStatement) and inserting parametres to sql UPDATE via concatenation. SQL script of declaring the tables has been generated from physical data model diagram by Power Designer. It creates table fields as “date”, “id_v”, “id” and so on, so the problem was not in date field.
Maybe it should be
AND (id_vid = ?)for the second condition?Right now, it says
AND (id vid = ?)which is probably a typo.