`

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';

 格式需要对应!!

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics