我有这个一个查询sql,select count(*) from t_yd_user where 1 = 1 and (in_date >= ? and in_date <= ?)
,我的这两个?是动态赋值进去的,执行时报这个错?ORA-01858: 在要求输入数字处找到非数字字符
程序中我动态赋值是这样赋值的:
sb.append(" and (in_date >= ? and in_date <= ?) ");
list.add("to_date("+c.getInDatebegin()+",'YYYY-MM-DD')");
list.add("to_date("+c.getInDateend()+",'YYYY-MM-DD')");
断点后台list中有两个值[to_date(2010-07-10,'YYYY-MM-DD'), to_date(2010-08-11,'YYYY-MM-DD')],也就是说我的两个占位符?都有值了,在数据库里执行是没有问题的,select count(*) from t_yd_user where 1 = 1 and (in_date >= to_date('2010-07-11','YYYY-MM-DD') and in_date <= to_date('2010-08-11','YYYY-MM-DD')),可是程序中执行为什么会报这个错?请教大家帮看看,谢谢了!
,我的这两个?是动态赋值进去的,执行时报这个错?ORA-01858: 在要求输入数字处找到非数字字符
程序中我动态赋值是这样赋值的:
sb.append(" and (in_date >= ? and in_date <= ?) ");
list.add("to_date("+c.getInDatebegin()+",'YYYY-MM-DD')");
list.add("to_date("+c.getInDateend()+",'YYYY-MM-DD')");
断点后台list中有两个值[to_date(2010-07-10,'YYYY-MM-DD'), to_date(2010-08-11,'YYYY-MM-DD')],也就是说我的两个占位符?都有值了,在数据库里执行是没有问题的,select count(*) from t_yd_user where 1 = 1 and (in_date >= to_date('2010-07-11','YYYY-MM-DD') and in_date <= to_date('2010-08-11','YYYY-MM-DD')),可是程序中执行为什么会报这个错?请教大家帮看看,谢谢了!
,看看SB 传给数据库的字符串是什么,贴出来执行下,看是否会报错