1

我有一条错误提示“ORA-00933:SQL 命令未正确结束”

 rs = st.executeQuery("select * from msg_new_to_bde t where t.ACTION = 804 and t.seq > ? order by t.seq desc" + sequenceID);
4

3 回答 3

2

you are concatenating sequenceID to you query. its not a valid query.

I think your query should be something like below:

     rs = st.executeQuery("select * from msg_new_to_bde t 
      where t.ACTION = 804 and t.seq > ? order by t.seq desc");  
     PreparedStatement.setInt(1,sequenceID );// setting the column using preparedStatement
于 2012-12-18T16:59:50.447 回答
1

Try this:

rs = st.executeQuery("select * from msg_new_to_bde t where t.ACTION = 804 and t.seq > " + sequenceID + " order by t.seq desc");
于 2012-12-18T16:59:59.613 回答
1

尝试将 sequenceID 作为参数传递给准备好的语句。

  String query="select * from msg_new_to_bde t where t.ACTION = 804 and t.seq > ? order by t.seq desc"; 
  // int(your datatype) input parameterized.  
  PreparedStatement st = con.prepareStatement(query);  
  st.setInt(1, sequenceID);  
  rs = st.executeQuery();  
于 2012-12-18T17:16:17.530 回答