title: Given a date, select all the week numbers that month contains
body: <p>I have an ApEx application for tracking working hours. 
  I have a view that looks like this:        </p>
  
  <pre><code>CREATE OR REPLACE VIEW HOURSDAYS
  AS SELECT
   (MAX("TO_X") - MIN("FROM_X"))*24 - 
   (max(case when PROJECT_ID = 999 then to_x else to_date('01012000','DDMMYYYY') end) -
    max(case when PROJECT_ID = 999 then from_x else to_date('01012000','DDMMYYYY') end))*24 AS TIME_SPENT,
   DAY,
   PERSON_ID
   FROM ATTENDANCE_HOURS
   GROUP BY PERSON_ID, DAY
   ORDER BY DAY DESC
  </code></pre>
  
  <p>I need the sum of hours per week. So I have this:</p>
  
  <pre><code>SELECT TO_CHAR(DAY,'IW'), MIN(DAY), MAX(DAY), SUM(TIME_SPENT)
  FROM HOURSDAYS
  WHERE PERSON_ID = (SELECT ID FROM ATTENDANCE_PEOPLE WHERE MAIL_SSO = V('APP_USER') AND ROLE = 0) AND
  EXTRACT (YEAR FROM DAY) = EXTRACT (YEAR FROM TO_DATE(:P100_DATE_PICKER,'DD-MON-RR')) 
  GROUP BY TO_CHAR(DAY,'IW')
  ORDER BY TO_CHAR(DAY,'IW') ASC 
  </code></pre>
  
  <p>And now the fun begins: I have a page item P100_DATE_PICKER and I need to display only those weeks that have > 0 days that belong to the month to which belongs the day I've picked using the date picker.
  For example, for 1.1.2015 I want only weeks 1, 2, 3, 4, 5 displayed. 24.3.2015: 9, 10, 11, 12, 13, 14.</p>
  
  <p>If anyone is interested in why would I do that, it is for validation - number of work hours per week cannot exceed 20/32, depends on what type of contract do you have.</p>