title: Count the no of saturdays and sundays in date range - oracle
body: <p>I have two parameters(<em>start_Date,end_Date</em>) from <strong>table1</strong></p>
  
  <p>I'm trying to count no of saturdays and sundays in a date range</p>
  
  <pre><code>star_Date=8/20/2014 13:52
  end_Date=8/28/2014 13:52
  </code></pre>
  
  <p>And result should be like this</p>
  
  <pre><code>Start_Date        end_date          No_of_leaves 
  8/20/2014 13:52   8/28/2014 13:52       2
  </code></pre>
  
  <p><strong>Update Section</strong></p>
  
  <pre><code>SELECT retouch_req_time,retouch_submit_time,(
          SELECT Count(*) FROM (SELECT To_char(start_date + ( LEVEL - 1 ), 'fmday') dt 
          FROM (WITH t AS (SELECT To_date (retouch_req_time, 'MM/DD/YYYY HH24:MI') start_date, To_date (retouch_submit_time, 'MM/DD/YYYY HH24:MI') end_date FROM TT)) 
          CONNECT BY LEVEL &lt;= end_date - start_date + 1) WHERE dt IN ('friday','saturday')) as worked_hours
  FROM TT
  </code></pre>