I am facing problems binding the prepared statement argument within the catsearch clause. On execution I get java.sql.SQLException: Invalid column index
I tried a few other methods, by escaping quotes(both single and double), but still running into SQL Exceptions (Invalid column/Missing right parentheses)
Appreciate if I could be pointed to the correct way of binding –
String sqlForcatString = SELECT * from EVENT_TABLE where catsearch(DATA,\’ %?% within TAG\’,null)
stmt = conn.prepareStatement(sqlForCatString);
stmt.setString(1,keyValue);
Your parameter is contained in a quoted string in the sql query and so it ist not recognizable by the sql parser. You should be able to use string concatenation inside the query to build this string instead: