MySQL报错解决–Parameter index out of range (1 > number of parameters, which is 0)
今天写数据库批量删除的时候,碰到了这个错误,我靠,改了我1个半小时。(发出来长个记性)
解决方案:查看?周围的单引号或者双引号。
代码语言:javascript复制 public int resumedeletemore(Connection con, List<String> list) throws Exception {
int row = 0;
String temp1 = "";
//开始截取
for (int i = 0; i < list.size(); i ) {
temp1 ="'" list.get(i) "',";
}
temp1 = temp1.substring(0, temp1.length() - 1);
String sql ="delete from user_resume where user_id in(" temp1 ");";
System.out.println(sql);
PreparedStatement stmt=con.prepareStatement(sql);
row=stmt.executeUpdate();
return row;
}
}