title: Oracle SQL to_date function not working on concatenated strings
body: <p>I've been looking for a reason that this isn't working for quite some time.  I'm concatenating two fields and attempting to run some date comparisons but it throws the error ORA-01843: not a valid month.  I'm not sure what I'm doing wrong here.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>SELECT
     sm.semester_date || cp.start_year AS effective
  FROM
     database.table cp,
     database.table2 sm
  WHERE   cp.semesters_id = sm.semesters_id 
  AND  to_date(sm.semester_date || cp.start_year, 'MM/DD/YYYY') &gt;= to_date('06/01/2011', 'MM/DD/YYYY')
  </code></pre>
  
  <p>It runs fine as long as I don't add that AND statement at the end.  But I need to filter the dataset.  </p>
  
  <p>When you run it without the filter it returns 08/15/2010 etc. </p>
  
  <p>I forgot to add the mask originally when I posted this, I've corrected that. However, it still returns this error  ORA-01840: input value not long enough for date format.  </p>
  
  <p><strong>EDIT  SOLUTION FOUND:</strong>
  Firstly, thanks to everyone for helping me with this, you guys are great.  Secondly, my error was being caused by a course without a start year.  Very frustrating since that shouldn't be able to happen.  Because the concatenated item had no year on it, it was throwing the error.  I only found this because you guys helped me fix my code up.  Thank you.</p>