title: Oracle SQL - Data from previous week (Sunday to Saturday) regardless of when it's run
body: <p>I'm looking to return data in Oracle for the last full week starting Sunday and finishing Saturday. This needs to be able to run any day of the week.</p>
  
  <p>So I know that this is possible in SQL Server as I have reports that do the exact same thing:-</p>
  
  <pre><code>SET @startdate = DATEADD(wk, -1, DATEADD(wk, DATEDIFF(wk, 0,getdate()), -1))
  SET @enddate = DATEADD(wk, DATEDIFF(wk, 0, getdate()), -1)
  </code></pre>
  
  <p>Today being Friday 17th March the above would return data between Sunday 5th March and Saturday 11th March.</p>
  
  <p>I want to do the same thing in Oracle. Everywhere I've looked so far comes back with results like this:-</p>
  
  <pre><code>SELECT TRUNC (SYSDATE) - (SELECT TO_CHAR (SYSDATE, 'D') FROM DUAL),
         TRUNC (SYSDATE) - (SELECT TO_CHAR (SYSDATE, 'D') + 1 FROM DUAL)
  FROM DUAL
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>SELECT SYSDATE AS TODAYS_DATE, 
         NEXT_DAY (SYSDATE - 7, 'SAT') AS PREV_SATURDAY,
         NEXT_DAY (SYSDATE - 7, 'SUN') AS PREV_SUNDAY
  FROM DUAL
  </code></pre>
  
  <p>I'm trying to avoid any 'sysdate-7' type code since that's pretty unwieldy in this situation - can anyone help at all?</p>
  
  <p>Thanks</p>