title: Oracle to_date function with quarter-format
body: <p>I need to find some records created in a range of quarters. For example, I'm looking for all records created between the 4th quarter of 2008 and the 1st quarter of 2010. I have this in my WHERE-clause:</p>
  
  <pre><code>...and r.record_create_date between to_date('2008 4','YYYY Q')
                                  and to_date('2010 1','YYYY Q')
  </code></pre>
  
  <p>but Oracle says: <code>ORA-01820: format code cannot appear in date input format</code>. The <code>Q</code> is a valid date format symbol, so I'm not sure what's happened. Is this even a valid way to find values in between calender quarters, or is there a better way?</p>
  
  <hr>
  
  <p>Also interesting, and possibly related, if I execute this:</p>
  
  <pre><code>select to_date('2009','YYYY') from dual;
  </code></pre>
  
  <p>The value displayed in my IDE is <code>2009-08-01</code>. I would have expected <code>2009-08-04</code>, since <em>today</em> is <code>2010-08-04</code>.</p>
  
  <p>This:</p>
  
  <pre><code>select to_date('2009 1','YYYY Q') from dual;
  </code></pre>
  
  <p>of course, fails.</p>
  
  <p>(Oracle 10g)</p>