title: How to calculate the first date and last date in a Period in Oracle SQL as per Gregorian Calendar
body: <p>I want to build a query to get the first date and last date of a period in Oracle SQL database as per the <a href="https://en.wikipedia.org/wiki/4%E2%80%934%E2%80%935_calendar" rel="nofollow noreferrer">4-4-5 calendar</a> to achieve something like below:</p>
  
  <p><a href="https://i.stack.imgur.com/Mc2kx.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Mc2kx.jpg" alt="enter image description here"></a></p>
  
  <p>Can anyone help me in the same? I tried with the below queries but not able to reach to the point:</p>
  
  <pre><code>alter session set NLS_TERRITORY = 'THE NETHERLANDS';
  alter session set NLS_CALENDAR='GREGORIAN';
  SELECT add_months(trunc(sysdate) - (to_number(to_char(sysdate,'DD')) - 1), 1) -1 FROM dual;
  </code></pre>