title: Oracle: SQL select date with timestamp
body: <p>I have the following data:</p>
  
  <pre><code>SQL&gt; select * from booking_session;
  
  BK_ID|BK_DATE
  -----|-------------------------
      1|18-MAR-12 10.00.00.000000
      2|18-MAR-12 10.25.00.000000
      3|18-MAR-12 10.30.00.000000
      4|18-MAR-12 10.35.00.000000
      5|18-MAR-12 10.40.00.000000
  </code></pre>
  
  <p>I am trying to write a <code>sql</code> query that selects all records that matches a certain date, however I am using timestamp for the <code>BK_DATE</code> field and no matter what I try it my query yields no results.</p>
  
  <p><strong>SQL</strong>: I have tried the following queries but they yield no results</p>
  
  <p>1.</p>
  
  <pre><code>select * 
  from booking_session
  where bk_date = to_date('18-03-2012', 'dd-mm-yyyy');
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>select * 
  from booking_session
  where bk_date = to_timestamp('18-03-2012', 'dd-mm-yyyy');
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>select * 
  from booking_session
  where bk_date = to_date('18-MAR-2012', 'dd-mm-yyyy');
  </code></pre>
  
  <p>It only works when I set the whole date value like;</p>
  
  <pre><code>select * 
  from booking_session
  WHERE bk_date = '18-MAR-12 11.00.00.000000';
  
  
  CREATE TABLE BOOKING_SESSION(
    BK_ID NUMBER NOT NULL,
    BK_DATE TIMESTAMP,
    BK_BOOKER NUMBER,
    BK_CUSTOMER NUMBER,
    BK_TREATMENT NUMBER,
    T_SESSION_DATETIME TIMESTAMP,
    STAFFAPPOINTED NUMBER,
    BK_ROOM NUMBER
  );
  
  INSERT INTO BOOKING_SESSION VALUES (
    1,
    TO_TIMESTAMP('18/03/2012 10:00', 'DD/MM/YYYY HH24:MI'),
    1,
    1,
    1,
    TO_TIMESTAMP('20/03/2012 11:00', 'DD/MM/YYYY HH24:MI'),2,1
  );
  </code></pre>