select max(sun) sun,
       max(mon) mon,
       max(tue) tue,
       max(wed) wed,
       max(thu) thu,
       max(fri) fri,
       max(sat) sat
  from (select decode(d, 1, dd) sun,
               decode(d, 2, dd) mon,
               decode(d, 3, dd) tue,
               decode(d, 4, dd) wed,
               decode(d, 5, dd) thu,
               decode(d, 6, dd) fri,
               decode(d, 7, dd) sat,
               iw
          from (select to_char(dates, 'd') d,
                       to_char(dates, 'dd') dd,
                       to_char(dates + 1, 'iw') iw,
                       dates
                  from (select trunc(to_Date('&date', 'yyyy-mm-dd'), 'mm') +
                               level - 1 dates
                          from dual
                        connect by level <= to_char(last_day(to_Date('&date',
                                                                     'yyyymmdd')),
                                                    'dd'))))
 group by iw
 order by iw