java.sql.SQLSyntaxErrorException:ORA-00905:缺少关键字

时间:2016-03-13 19:55:09

标签: java sql oracle11g

我尝试了以下SQL查询,但每次尝试运行时都会出现错误关键字错误。

PreparedStatement pstmt=conn.prepareStatement("Select A.SAP_ID, A.NAME, A.ROOM_NO, A.BRANCH, A.YEAR, O.OUT_DATE, O.OUT_TIME "
+ "FROM (ADD_STU A INNER JOIN OUT_TABLE O)"
+ "ON (A.SAP_ID=O.SAP_ID) "
+ "WHERE A.SAP_ID=? AND OUT_DATE=?");
pstmt.setString(1,jTextField3.getText());
pstmt.setString(2,date);
rs1=pstmt.executeQuery();

缺少什么关键字?

1 个答案:

答案 0 :(得分:1)

PreparedStatement pstmt=conn.prepareStatement("Select A.SAP_ID, A.NAME, A.ROOM_NO, A.BRANCH, A.YEAR, O.OUT_DATE, O.OUT_TIME "
  + "FROM ADD_STU A "
  + "  INNER JOIN OUT_TABLE O ON A.SAP_ID = O.SAP_ID "
  + "WHERE A.SAP_ID=? AND OUT_DATE=?");

问题在于括号()