Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6609365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:42:34+00:00 2026-05-25T19:42:34+00:00

Given 2 dates (StartDate and EndDate), how to do i generate quarterly periods in

  • 0

Given 2 dates (StartDate and EndDate), how to do i generate quarterly periods in Pl/SQL.

Example:

Start Date: 01-JAN-2009
End Date: 31-DEC-2009

Expected Output:

StartDate        EndDate
01-JAN-2009      31-MAR-2009
01-APR-2009      30-JUN-2009
01-JUL-2009      30-SEP-2009
01-OCT-2009      31-DEC-2009
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T19:42:34+00:00Added an answer on May 25, 2026 at 7:42 pm
    SELECT  ADD_MONTHS( TRUNC(PARAM.start_date, 'Q'), 3*(LEVEL-1) )   AS qstart
        ,   ADD_MONTHS( TRUNC(PARAM.start_date, 'Q'), 3*(LEVEL) ) -1  AS qend
    FROM    (   SELECT  TO_DATE('&start_date')  AS start_date
                    ,   TO_DATE('&end_date')    AS end_date
                FROM    DUAL
            ) PARAM
    CONNECT BY ADD_MONTHS( TRUNC(PARAM.start_date, 'Q'), 3*(LEVEL) ) -1
            <= PARAM.end_date
    

    Rules for params, you may need to adjust the query to suit your purposes:

    • If start_date is not exact quarter start it effectively uses the quarter contain start date.
    • If end_date is not exact quarter end then we end on the quarter that ended BEFORE end_date (not the one containing end date).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to generate records on given start-date, end-date and time frequency(Weekly, Monthly etc.)
A table exists in Microsoft SQL Server with record ID, Start Date, End Date
If I was to given a specific java.util.Date, how can I generate a start
tl;dr; How would you take StartDate-DateTime: Dec 10th 2011, EndDate-DateTime Jan 15th 2012, and
Given three tables Dates(date aDate, doUse boolean), Days(rangeId int, day int, qty int) and
Given two date/times: @start_date = '2009-04-15 10:24:00.000' @end_date = '2009-04-16 19:43:01.000' Is it possible
$sq = SELECT count(noofrows),QUARTER(Date(last_call)) as quarter,YEAR(last_call) FROM $dbt.travel_crm WHERE Date(last_call) BETWEEN '.$_GET['startdate'].' AND '.$_GET['enddate'].'
Find third Sunday of each month occur between given below two dates . Start
I have two varchar(30), startDate and endDate coloumn and it has dates values and
I have an object that has a start date and an end date, in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.