Parameter index out of range (2 > number of parameters, which is 1).

Parameter index out of range (2 > number of parameters, which is 1).

错误是预插入语句少了两个问号导致的,原因可能是sql语句'号使用不当导致的

String sql = "select * from t_mobile_picture where PIC_STATUS = '1"
				+ "' and IMEI_ID != ?" 
				+ " and (POW(ADJUST_JINGDU-?,2)+POW(ADJUST_WEIDU-?,2)<1)"
				+" order by CREATE_TIME desc limit ?,?";

 

如果不小心写成

String sql = "select * from t_mobile_picture where PIC_STATUS = '1"
				+ "' and IMEI_ID != ?" 
				+ "' and (POW(ADJUST_JINGDU-?,2)+POW(ADJUST_WEIDU-?,2)<1)"
				+" order by CREATE_TIME desc limit ?,?";

 

 

就会报上面的错误,"' and (POW 就这里的'导致的。

你可能感兴趣的:(数据库)