title: Counting the number of days excluding sunday between two dates
body: <p>I am trying to calculate number of days betwen two dates excluding sundays. This is my query,</p>
  
  <pre><code>SELECT   F_PLANHM_END_DT
         - F_PLANHM_ST_DT
         -   2
           * (TO_CHAR (F_PLANHM_END_DT, 'WW') - TO_CHAR (F_PLANHM_ST_DT, 'WW'))
    FROM VW_S_CURV_PROC
   WHERE HEAD_MARK = 'IGG-BLH-BM 221';
  
  SELECT COUNT (*)
    FROM (SELECT SYSDATE + l trans_date
            FROM (    SELECT LEVEL - 1 l
                        FROM VW_S_CURV_PROC
                  CONNECT BY LEVEL &lt;= ( (SYSDATE + 7) - SYSDATE)))
   WHERE TO_CHAR (trans_date, 'dy') NOT IN ('sun');
  </code></pre>
  
  <p>I am retrieving date from a view called VW_S_CURV_PROC with start date : F_PLANHM_ST_DT and end date F_PLANHM_END_DT. Somehow i cant make this to work. Please help me...</p>