title: ORA-01847 day of month must be between 1 and last day of month - but data is OK
body: <p><em>Problem is solved - see end of this post.</em></p>
  
  <p>when i call to_date in select clause everything works fine - get a resultset of     12 records:</p>
  
  <pre><code>select value1,to_date(value1,'DD.MM.YYYY') 
    from variableindex 
    where 
      value1 is not null 
      and value1 &lt;&gt; '0' 
      and creation_time_ &gt; to_timestamp('20140307','YYYYMMDD')
    order by 2
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>'VALUE1'     'TO_DATE(VALUE1,'DD.MM.YYYY')'
  '25.11.2013' 25.11.13
  '12.03.2014' 12.03.14
  '12.03.2014' 12.03.14
  '12.03.2014' 12.03.14
  '12.03.2014' 12.03.14
  '12.03.2014' 12.03.14
  '14.03.2014' 14.03.14
  '14.03.2014' 14.03.14
  '14.03.2014' 14.03.14
  '14.03.2014' 14.03.14
  '20.03.2014' 20.03.14
  '20.03.2014' 20.03.14
  </code></pre>
  
  <p>Every datestring has been converted as expected.</p>
  
  <p>If i add the following line to where clause</p>
  
  <pre><code>and to_date(value1,'DD.MM.YYYY') &lt; to_date('20140301','YYYYMMDD')
  </code></pre>
  
  <p>i'll receive:</p>
  
  <pre><code>ORA-01847: Tag des Monats muss zwischen 1 und letztem Tag des Monats liegen
  01847. 00000 -  "day of month must be between 1 and last day of month"
  *Cause:    
  *Action:
  </code></pre>
  
  <p>No it really gets nasty... i changed my query to </p>
  
  <pre><code>where id_ in (...)
  </code></pre>
  
  <p>and used the same 12 recordsets ids as in original query. No Error...</p>
  
  <p>Many thanks to @GordonLinoff - this is how i use the query now:</p>
  
  <pre><code>select value1,to_date(value1,'DD.MM.YYYY') from variableindex 
     where 
     (case when value1 &lt;&gt; '0'  then to_date(value1,'DD.MM.YYYY') end) &gt;  to_timestamp('20131114','YYYYMMDD')
     and creation_time_ &gt; to_timestamp('20140307','YYYYMMDD')
  order by 2;
  </code></pre>