title: SQL date conversion results to "invalid number format model parameter."
body: <p>I have to <code>select</code> some data from <code>Oracle 11g</code> database, but I can't seem to figure out why following <code>select</code> query is failing:</p>
  
  <pre><code>SELECT
    INFO_ID,
    INFO_DETAIL, 
    IMPORTANT_FLG, 
    DELETE_FLG, 
    CREATE_TIME, 
    DISPLAY_ORDER
    FROM  TABLE_NAME
    WHERE TO_DATE(TO_CHAR(CREATE_TIME, 'YYYY/MM/DD'), 'YYYY/MM/DD')
    BETWEEN TO_DATE(TO_CHAR(:fromDate, 'YYYY/MM/DD'), 'YYYY/MM/DD') AND TO_DATE(TO_CHAR(:toDate, 'YYYY/MM/DD'), 'YYYY/MM/DD')
    ORDER BY IMPORTANT_FLG DESC NULLS LAST , DISPLAY_ORDER ASC NULLS LAST, CREATE_TIME DESC, INFO_ID ASC
  </code></pre>
  
  <p>The query is failing with following error message:</p>
  
  <pre><code>ORA-01481: invalid number format model
  01481. 00000 -  "invalid number format model"
  *Cause:    The user is attempting to either convert a number to a string
         via TO_CHAR or a string to a number via TO_NUMBER and has
         supplied an invalid number format model parameter.
  </code></pre>
  
  <p>My input for the variables <code>fromDate</code> and <code>toDate</code> are just date strings such as <code>20111010</code> etc. I have tried also more specific time (same format as in the table), but that doesn't seem to be the problem..</p>
  
  <p>In the database the <code>CREATE_TIME</code> column is <code>TIMESTAMP(6)</code> type, and for example one sample is <code>2011/12/19 08:04:42</code></p>
  
  <p>Any ideas why this is error pops up?</p>