日期:2014-05-17  浏览次数:20723 次

为什么几乎是同样的语句,一个能执行,一个不能执行?
select   *   from   tbinarticles   ba
where   ba.fexpiracy   >   '2007-06-18 '

select   *   from   file_wm_trecvlog   d
where   d.frecvtime   >   '2007-06-18 ';

select   *   from   wm_mis_trecvlog   d
where   d.frecvtime   >   '2007-06-18 '

执行第一条语句时,正常执行。
执行第二、第三条语句时,就报下面的错误:
ORA-01861:文字与格式字符串不匹配。

我看了一下,第一条语句和第二、第三条语句中的字段类型都是DATA型的,都是不允许空的。

哪位知道这是咋回事呀。。。

------解决方案--------------------
在日期字符串前加一date:
select * from wm_mis_trecvlog d
where d.frecvtime > date '2007-06-18 '
------解决方案--------------------
--或者转换一下
select * from wm_mis_trecvlog d
where to_char(d.Opdate, 'yyyy-mm-dd ') > '2007-06-18 '
------解决方案--------------------
改成这样:
select * from tbinarticles ba
where to_char(ba.fexpiracy, 'YYMMDD ') > '070618 ';

select * from file_wm_trecvlog d
where to_char(d.frecvtime, 'YYMMDD ') > '070618 ';

select * from wm_mis_trecvlog d
where to_char(d.frecvtime, 'YYMMDD ' > '070618 ';

也有可能是什么地方用了中文输入,建议重新写一下这段

------解决方案--------------------
select * from file_wm_trecvlog d
where d.frecvtime > to_date( '2007-06-18 ', 'yyyy-mm-dd ');