title: Testing the Oracle to_date function
body: <p>I'm writing an integration test in Grails using GORM. </p>
  
  <p>I want to do something like the following:</p>
  
  <pre><code>delete from Statistic 
  where stat_date = TO_DATE(:month_year, 'MON-YYYY')
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <blockquote>
    <p>java.sql.SQLException: Unexpected token: TO_DATE in statement [delete
    from statistics where stat_date=TO_DATE(?, 'MON-YYYY')]</p>
  </blockquote>
  
  <p>I think the error is caused by the in memory database used by GORM (is it H2?) not supporting the to_date function.</p>
  
  <p>Any ideas on how to write the delete SQL so that it works in a test and in live?</p>
  
  <p>As I only really care about the Month and Year one thought I had would be to delete the records where the stat_date is between the first and last date of the given month.</p>
  
  <p>Can any one think of a better way?</p>