日期:2014-05-19  浏览次数:20717 次

SQL语句在数据库执行没问题,为什么放到项目里就出错了
操作失败:org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [select count(*) total from (select tp.N_RRE_TAKE_STATUS,tm.V_MAIL_CODE,tp.D_PRE_DELIVER_TIME,tp.D_INSERT_TIME,op.person_name,tp.V_FAIL_REASON_CODE from TB_P_DELIVER_PRE tp,TB_P_MAIL tm,TB_CUST_INFO tc,UTL_OPERATION uo,TB_P_MAIL_BAT tb,org_department od,org_person op where tm.n_cust_id=tc.cust_id and tc.manager_id=op.recid and tm.n_business_id=uo.id and tm.n_bat_id=tb.n_bat_id(+) and tp.V_RESE_ORG_ID=od.dept_code and tp.N_MAIL_ID=tm.N_MAIL_ID and tp.N_RRE_TAKE_STATUS=? )]; ORA-01722: 无效数字 ; nested exception is java.sql.SQLException: ORA-01722: 无效数字!

  tp.N_RRE_TAKE_STATUS=? 传递过的参数是1或者0 求大神解释

------解决方案--------------------
从语句来看,可能是隐式转换时发生错误了。

也就是你用一个非数字的字段 跟 数字 进行匹配,Oracle在进行转换时,发现有值无法转换为数字,所以无奈报错。
------解决方案--------------------
是不是按照字符接收的,你将传进的数字在传进去之前转换成数字试试。