为什么这两个选择查询的Oracle 11g:比较日期
create table tmp (d date);
insert into tmp (d) values (sysdate);
select * from tmp where d = sysdate;
select * from tmp where d = trunc(sysdate);
都返回0行?
select to_timestamp(d), to_timestamp(sysdate) from tmp;
清楚地表明,这两个列相等:
TO_TIMESTAMP(D) | TO_TIMESTAMP(SYSDATE)
July, 01 2013 00:00:00+0000 | July, 01 2013 00:00:00+0000
当我跑到你的代码,这两个查询*做*回报1行 - 但那是因为我是非常快,我在午夜时分运行它们:) –