日期:2014-05-16  浏览次数:20557 次

ORA-01722: 无效数字的解决方法

List<Atl> atls = commonDao.findByQuery("from Atl a where a.code ="+code);
报错:ORA-01722: 无效数字

List<Atl> atls = commonDao.findByQuery("from Atl a where a.code <>null");
通过。
List<Atl> atls = commonDao.findByQuery("from Atl a where a.code =:code",
??? new String[]{"code"},new Object[]{code});
这种写法不会报错,通过

解决:1,code的隐式转换
????? 2,nvl( ) 函数 从两个表达式返回一个非 null 值。 NVL(n1,n2) ,若n1为null,则返回n2,若n1不为null,则返回n1
返回值类型
字符型、日期型、日期时间型、数值型、货币型、逻辑型或 null 值

?