title: Oracle SQL get last year of dates excluding weekends
body: <p>I'd expect this to work to get me a list of calendar dates over the past 12 months excluding weekends; but it just gives me the entire list of dates - which I suppose is fine - but want to know why the below is incorrect.</p>
  <pre><code>SELECT ADD_MONTHS(TRUNC(SYSDATE,'MM'),-12) - 1 + rownum AS CalendarDate
  FROM all_objects
  WHERE ADD_MONTHS(TRUNC(SYSDATE,'MM'),-12) - 1 + rownum &lt;= sysdate
  AND to_char(sysdate,'DY') NOT IN ('SAT','SUN')
  </code></pre>