设为首页 加入收藏

TOP

SQL语句报错(一)
2014-11-23 22:20:54 来源: 作者: 【 】 浏览:10
Tags:SQL 语句

SQL语句报错(一)

1、具体报错如下:

ORA-01861:文字格式字符串不匹配

01861. 00000 - "literal does not match format string"

*Cause:Literals in the put must be the same length as literals in the format string

(with the exception of leading whitespace).

If the "FX" modifier has been toggled on,the literal must match exactly,with

no extra whitespace.

*Action:Correct the format string to match the literal.

2、错误原因

sb.append(" and t.date >= and t.date <= ");

由于date这个字段在数据库中的数据类型是Date,而我给date传的参数是字符串类型的,而字符串是不能比较大小的,所以会报个错误

3、解决办法

sb.append(" and t.date >= to_date( ,'yyyymmdd') and t.date <= to_date( ,'yyyymmdd') ");

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇SQL字符串处理函数 下一篇Sql中把datetime转换成字符串(CO..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: