title: Literal does not match format string for Oracle SQL to_date on a string column
body: <p>Dear SQL Gurus from Stack Overflow:</p>
  
  <p><strong>Environment:</strong> Oracle</p>
  
  <p>I'm trying to understand why I can't do a to_date selection on a table column that contains strings. Note tableZ with a column of name Value in the example below contains a bunch of strings, some of which are the correct format, for example 6/20/2010 00:00:00.</p>
  
  <p>tableZ </p>
  
  <pre><code>| Value              |
  | __________________ |
  | 6/21/2010 00:00:00 |
  | Somestring         |
  | Some Other strings |
  | 6/21/2010 00:00:00 |
  | 6/22/2010 00:00:00 |
  </code></pre>
  
  <p><strong>The following works</strong></p>
  
  <pre><code>SELECT To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') somedate 
            FROM tableX a, tableY b, tableZ c 
           WHERE Lower(a.name) = 'somedate' 
             AND a.id = b.other_id 
             AND b.id = c.new_id
  </code></pre>
  
  <p>This returns something like (which is good):</p>
  
  <pre><code>| somedate            |
  | __________________  |
  | 21.06.2010 00:00:00 |
  | 21.06.2010 00:00:00 |
  | 22.06.2010 00:00:00 |
  </code></pre>
  
  <p><strong>The following does not work</strong></p>
  
  <pre><code>SELECT To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') somedate 
            FROM properties$aud a, template_properties$aud b, consumable_properties$aud c 
           WHERE Lower(a.name) = 'somedate' 
             AND a.id = b.property_id 
             AND b.id = c.template_property_id 
             AND To_Date(c.Value, 'MM/DD/YYYY HH24:MI:SS') IS NOT NULL
  </code></pre>
  
  <p>Comes back with:</p>
  
  <p><strong><em>ORA-01861: literal does not match format string</em></strong></p>
  
  <p>What am I missing here? Just a quick note:</p>
  
  <pre><code> ...
  AND b.id = c.template_property_id 
  AND To_Date(c.Value, 'DD.MM.YYYY HH24:MI:SS') IS NOT NULL
  </code></pre>
  
  <p>doesn't work either.</p>
  
  <p>Thanks!!</p>
  
  <p><strong>Goal</strong> to be able to do date BETWEEN queries on c.value in order to select date ranges.</p>