ORA-01008: not all variables bound
源码:
pst = con.prepareStatement(sql);
pst.setString(1, newCard);
pst.setString(2, userMobilephone);
int i= pst.executeUpdate(sql);
修改如下:
pst = con.prepareStatement(sql);
pst.setString(1, newCard);
pst.setString(2, userMobilephone);
int i= pst.executeUpdate();
出错原因: pst.executeUpdate(sql) 代了参数
先前用的statement 后换为prepareStatement 一不小心耽误一个多小时,特地发表于此,供大家借鉴,哈哈哈,反面教材
源码:
pst = con.prepareStatement(sql);
pst.setString(1, newCard);
pst.setString(2, userMobilephone);
int i= pst.executeUpdate(sql);
修改如下:
pst = con.prepareStatement(sql);
pst.setString(1, newCard);
pst.setString(2, userMobilephone);
int i= pst.executeUpdate();
出错原因: pst.executeUpdate(sql) 代了参数
先前用的statement 后换为prepareStatement 一不小心耽误一个多小时,特地发表于此,供大家借鉴,哈哈哈,反面教材
本文介绍了一个常见的数据库编程错误ORA-01008:not all variables bound,并给出了具体的解决方案。通过对比使用statement与prepareStatement的不同之处,解释了如何避免因参数绑定不当引发的问题。
3441

被折叠的 条评论
为什么被折叠?



