java.sql.SQLException: ORA-00928: missing SELECT keyword. when inserting record to DB using JDBC java.sql.SQLException: ORA-00928: missing SELECT keyword. when inserting record to DB using JDBC oracle oracle

java.sql.SQLException: ORA-00928: missing SELECT keyword. when inserting record to DB using JDBC


You need to change the SQL statement. (Never use reserved words as identifiers)

String insertStmt = "INSERT into \"MY_TABLE\" (RECORD_TYPE,FILE_TYPE,               \"DATE\",BATCH_NO,RECORD_COUNT) VALUES (?, ?, ?, ?, ?)";

Use " (double quotes) to escape the reserved words/keywords.


I can spot two problems:

  1. No need for single quotes around column names. But you may wrap it in double quotes. It is necessary if you are using reserved keywords for column names or table names. Here DATE.
  2. You need a space before VALUES.

So you need to change insertStmt to somthing like this:

String insertStmt = "INSERT into " +    "MY_TABLE(RECORD_TYPE, FILE_TYPE, \"DATE\", BATCH_NO, RECORD_COUNT) " +    "VALUES(?, ?, ?, ?, ?);";


Print insertStmt String in Console and try to fire it in directly backend. It gives you exact error in backend. It seens some spacing or syntax error.