title: SQL to create table with weeks in period - having breaks at month's end (Oracle)
body: <p>I need to create a table with the following structure:</p>
  <p>calendar week; week start date; week end date</p>
  <p>which contains all weeks beginning in 2007 until the current week.</p>
  <p>The special thing is, that when an end of month falls within a week, the week is cut in two slices - one record that has a start date that is the beginning of the week and the end date is the last day of the month, and one record that contains the dates of the rest of the week (start date is first of the new month, end date is last day of the week).</p>
  <p>Example (beginning of week is monday):<br />
  <code>calendar week; week start date; week end date;   ...   2009 cW48;     23.11.2009;      29.11.2009    --&quot;normal&quot; week with 7 days, beginning monday and ending sunday   2009 cW49;     30.11.2009;     30.11.2009    --first part of the CW49, which ends at last day of the month   2009 cW49;     01.12.2009;     06.12.2009    --second part of the CW49, which begins at fist day of the new month   2009 cW50; 07.12.2009; 13.12.2009    --&quot;normal&quot; week, without a monthly break   ... </code></p>
  <p>How to create such a table in Oracle (SQL or PL SQL)?</p>