b657834
b657834
2015-03-11 09:38

oracle jdbc update bind 不成功

  • java

正常的oralce update语句:

update apmtest set apm_int=20 where apm_nchar='11' and apm_numeric='12';

不知道为什么jdbc update bind两个参数时,就是执行不成功?怀疑是单引号的问题

执行不成功:

PreparedStatement ps_update1 = con
.prepareStatement("update apmtest set apm_int=? where apm_nchar=? and apm_numeric=?");
ps_update1.setInt(1, 20);
ps_update1.setString(2, "11");
ps_update1.setString(3, "12");

ps_update1.execute();

执行成功:

PreparedStatement ps_update1 = con
.prepareStatement("update apmtest set apm_int=? where apm_nchar='11' and apm_numeric=?");
ps_update1.setInt(1, 20);
ps_update1.setString(2, "12");
ps_update1.execute();

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答