java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
时间: 2023-10-12 16:58:08 浏览: 268
回答: 这个错误是由于参数索引超出了参数的范围所引起的。具体来说,错误信息中的(2 > number of parameters, which is 1)表示参数索引为2,而实际上只有1个参数。这通常是在使用占位符赋值时出现的问题,当参数索引超出了占位符的个数时就会报错。因此,需要检查代码逻辑,确保参数索引与占位符的个数匹配。
#### 引用[.reference_title]
- *1* *2* [报SQL异常:java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is ...](https://blog.csdn.net/weixin_46029637/article/details/128535098)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [java.sql.SQLException: Parameter index out of range (5 > number of parameters, which is 3).](https://blog.csdn.net/Too_Soup_Soup/article/details/121972166)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文