Search code examples
prepared-statementapostrophe

Oracle - PreparedStatement Command not properly Ended


I am using Oracle 11g, and when I try to create a select statement with an apostrophe, I get the following error.

Is the prepared statement suppose to take care of apostrophes or should I do it? Is there a way to see the query just before execution (with true values instead of '?') ?


Solution

  • You are lacking a space between the name of the table (T) and WHERE. Thus the SQL that gets executed looks something like this SELECT * FROM TABLE TWHERE T.COL1 = '<somevalue>' AND T.COL2 = '<somevalue>' AND T.COL3 = '<somevalue>' - note the TWHERE.