一切都是

在网上查oracle的日期函数用法,得到一大堆语法,林林总总,,没能解决我的问题。

其实,我想写这么一条语句:查找某个日期(不含时分秒)产生或有关的记录。咋写?

SQL SERVER下就容易咯,

select * from table1 where createdate='2017-01-10'


多么容易,新手拈来。但是,在ORACLE下可不行。

找来找去,是这样的:

select * from table1 where to_char(createdate,'yyyy-MM-dd')='2017-01-10';


如果是当天,就简单一些:

select * from table1 where trunc(createdate,'dd')=trunc(sysdate,'dd');