ORA-01858 :在要求输入数字处找到非数字字符

   java链接oracle数据库的时候遇到了:ORA-01858 :在要求输入数字处找到非数字字符    这个错误,后续自己解决了,把原因和解决办法贴出来,大家看看


2017-04-27 08:52:37,284 ERROR [com.iss.amc.bat.fundNav.dao.FundNavDAO] [com.iss.amc.framework.core.dao.BaseDAO$4.doInConnection(BaseDAO.java:253)] - execute failed
java.sql.BatchUpdateException: ORA-01858: 在要求输入数字处找到非数字字符

at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10720)
at com.mchange.v2.sql.filter.FilterPreparedStatement.executeBatch(FilterPreparedStatement.java:260)
at com.iss.amc.framework.core.dao.BaseDAO$4.doInConnection(BaseDAO.java:243)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:289)
at com.iss.amc.framework.core.dao.BaseDAO.executeUpdateMutil(BaseDAO.java:224)
at com.iss.amc.bat.fundNav.dao.FundNavDAO.insertSynchLog(FundNavDAO.java:109)
at com.iss.amc.bat.fundNav.bo.impl.FundNavBOImpl.insertSynchLog(FundNavBOImpl.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:126)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy2.insertSynchLog(Unknown Source)
at com.iss.amc.bat.scanQuartz.action.scanQuartzAction.scanHuaxiaFildor(scanQuartzAction.java:367)
at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:283)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:272)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)


下面是我出错的代码:
ORA-01858 :在要求输入数字处找到非数字字符_第1张图片

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


修改后的代码:
ORA-01858 :在要求输入数字处找到非数字字符_第2张图片






你可能感兴趣的:(ORA-01858 :在要求输入数字处找到非数字字符)