Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
LIKE语句中包含变量的SQL:列索引无效_Sql_Oracle_Variables_Sql Like_Setstring - Fatal编程技术网

LIKE语句中包含变量的SQL:列索引无效

LIKE语句中包含变量的SQL:列索引无效,sql,oracle,variables,sql-like,setstring,Sql,Oracle,Variables,Sql Like,Setstring,我在用甲骨文 PreparedStatement pstmt = con.prepareStatement("SELECT * FROM BookLoanInfo WHERE title LIKE '%?%' ORDER BY bid"); ResultSet rs; String bookstring = scan.nextLine(); try{ pstmt.clearParameters(); pstmt.setString(1, bookstring); rs =

我在用甲骨文

PreparedStatement pstmt = con.prepareStatement("SELECT * FROM BookLoanInfo WHERE title LIKE '%?%' ORDER BY bid");
ResultSet rs;
String bookstring = scan.nextLine();
try{
    pstmt.clearParameters();
    pstmt.setString(1, bookstring);
    rs = pstmt.executeQuery();
实际的问题似乎与
setString
或我如何键入查询有关


但是,这会产生无效的列索引。

您需要在
setString
语句中指定通配符