Oracle catsearch 中的 Java 准备语句
我面临着在 catsearch 子句中绑定准备好的语句参数的问题。执行时我得到 java.sql.SQLException: Invalid columns index 我尝试了一些其他方法,通过转义引号(单引号和双引号),但仍然遇到 SQL 异常(无效列/缺少右括号) 如果我能指出正确的绑定方式,我将不胜感激 -
String sqlForcatString = SELECT * from EVENT_TABLE where catsearch(DATA,\' %?% inside TAG\',null) stmt = conn.prepareStatement(sqlForCatString); stmt.setString(1,keyValue);
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);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的参数包含在 sql 查询中的带引号的字符串中,因此 sql 解析器无法识别它。您应该能够在查询中使用字符串串联来构建此字符串:
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: