首页 > 代码库 > Springmvc UPDATE 数据时 ORA-01858:a non-numeric character was found where a numeric was expected

Springmvc UPDATE 数据时 ORA-01858:a non-numeric character was found where a numeric was expected

ORA-01858:a non-numeric character was found where a numeric was expected 异常。

我的代码:

主要是绑定变量带出来的问题。

技术分享

出错原因是:preparedstatement在执行的时候不能把带有to_date的参数的串替换为sql中的问号,主要是to_date函数替换不了,解决办法是将to_date函数先放到sql语句中,然后替换后面的变量,就不报这个错误了。

错误异常:

技术分享

 

 修改后的代码:

技术分享

 参考: http://blog.csdn.net/u010526028/article/details/70843610

 

Springmvc UPDATE 数据时 ORA-01858:a non-numeric character was found where a numeric was expected