oracle date 比较

select * from topic where create_time > '2014-04-02';

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

   原因 : 这样比较的话,左边是日期,而右边是字符串!

  所以先要进行转换 ,

  一种是 :

 

select * from topic where create_time > to_date('2014-04-02','yyyy-mm-dd');

 另一种 :

  

 select * from topic where to_char(create_time,'yyyy-dd-mm') > '2014-04-02';

 格式需要对应!!

猜你喜欢

转载自kainever7.iteye.com/blog/2199610