`
zqc_0101
  • 浏览: 226985 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

java.sql.SQLException: ORA-01722: 无效数字

阅读更多

出现这种异常的情景之一就是使用PreparedStatement不当,例如:

 

pstmt = conn.prepareStatement("select * from table where name=" + "wukong");

 

执行上面的语句后,就会报这个异常.

 

应该正确使用PreparedStatement,例如:

pstmt = conn.prepareStatement("select * from table where name=?");

pstmt.setString(1, "wukong");

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics