title: Oracle 11g: compare DATE
body: <p>Why these two select queries</p>
  
  <pre><code>create table tmp (d date);
  insert into tmp (d) values (sysdate);
  
  select * from tmp where d = sysdate;
  select * from tmp where d = trunc(sysdate);
  </code></pre>
  
  <p>both return 0 rows?</p>
  
  <pre><code>select to_timestamp(d), to_timestamp(sysdate) from tmp;
  </code></pre>
  
  <p>clearly shows that both columns are equal:</p>
  
  <pre><code>TO_TIMESTAMP(D)             | TO_TIMESTAMP(SYSDATE)
  July, 01 2013 00:00:00+0000 | July, 01 2013 00:00:00+0000
  </code></pre>
  
  <p><a href="http://sqlfiddle.com/#!4/cdaba/1" rel="nofollow">SQL Fiddle example</a></p>