Generate all the quarters between start and end dates

Hello all,
I have a query in which i have two dates that is Start Date and End Date and now i have to populates all the quarters date between the date range:
For eg:
Start Date : 1-Apr-2011
End Date: 1-Jul-2012
Now taking these two values i want the recors as displayed below
Apr 2011
Jul 2011
Oct 2011
Jan 2012
Apr 2012
Jul 2012
So how can write my PL/SQL query to accomplish this task
Thanks in advance

958964 wrote:
Hello all,
I have a query in which i have two dates that is Start Date and End Date and now i have to populates all the quarters date between the date range:
For eg:
Start Date : 1-Apr-2011
End Date: 1-Jul-2012
Now taking these two values i want the recors as displayed below
Apr 2011
Jul 2011
Oct 2011
Jan 2012
Apr 2012
Jul 2012
So how can write my PL/SQL query to accomplish this task
Thanks in advanceHow do I ask a question on the forums?
SQL and PL/SQL FAQ
solution can be done in SQL only; no PL/SQL.

Similar Messages

  • Make Quarters from Start and End date

    Hi,
    I have a requirement to make the quarters for fiscal year from the given start and end date.
    For example if I have
    start date : 01-Jan-09
    end date : 31-Dec-09
    I have to split it into 4 quarters as bellow:
    QTR1 : 01-Jan-09 - 31-Mar-09
    QTR2 : 01-Apr-09 - 30-Jun-09
    QTR3 : 01-Jul-09 - 30-Sept-09
    QTR4 : 01-Oct-09 - 31-Dec-09
    plz help.
    Regards,
    Fahim

    Hi,
    SQL> SELECT ADD_MONTHS(to_date('01-JAN-2008','DD-MON-YYYY'),(ROWNUM-1)*3) start_dt,(ADD_MONTHS(to_date('01-JAN-2008','DD-MON-YYYY'),ROWNUM*3))-1 End_Date
      2  FROM DUAL
      3  CONNECT BY ADD_MONTHS(to_date('01-JAN-2008','DD-MON-YYYY'),(LEVEL-1)*3) <=to_date('30-SEP-2009','DD-MON-YYYY');
    START_DT  END_DATE
    01-JAN-08 31-MAR-08
    01-APR-08 30-JUN-08
    01-JUL-08 30-SEP-08
    01-OCT-08 31-DEC-08
    01-JAN-09 31-MAR-09
    01-APR-09 30-JUN-09
    01-JUL-09 30-SEP-09
    7 rows selected.
    SQL>Cheers,

  • Generate all Months between start and end dates using Parameter

    Hi,
    I have a query in which i have two dates that is Start Date and End Date and now i have to populates all the Months between the date range:
    Start Date : APR-12
    End Date: JUL-12
    Now taking these two values i want the recors as displayed below
    APR-12
    MAY-12
    JUN-12
    JUL-12
    So how can write my SQL query to finish this task
    Thanks

    Sounds easy with single pair of Months:
    with data(st_dt, end_dt) as
      select to_date('JAN-2012', 'MON-YYYY'), to_date('SEP-2012', 'MON-YYYY') from dual
    select add_months(st_dt, level - 1  ) mons
      from data
    connect by level <= months_between(end_dt,st_dt) + 1;
    MONS   
    01-JAN-12
    01-FEB-12
    01-MAR-12
    01-APR-12
    01-MAY-12
    01-JUN-12
    01-JUL-12
    01-AUG-12
    01-SEP-12
    9 rows selected Please ensure to read {message:id=9360002} and post the question correctly with all the mentioned points in the thread. It facilitates the people to understand the problem clearly and provide a solution that is compatible with your Oracle Version.

  • Contract start and end date in BAPI_CONTRACT_CREATEFROMDATA

    HI,
    I am using BAPI_CONTRACT_CREATEFROMDATA to create a contract from within a custom ABAP program. However I cannot figure out how to get the contract start and end dates into the contract header. I know that you can enter them into the ONTRACT_DATA_IN table parameter but these dates only appear on the line items and not the header.
    Does anyone know which parameters on the function map to the contract header start and end dates.
    Thanks.

    Hi,
    there are also fields QT_VALID_F and QT_VALID_T for quotation or inquiry. So it looks like for different contract types you need to use different fields. This BAPI calls FM SD_SALESDOCUMENT_CREATE which has subroutine ms_move_header_in which maps from BAPI fields to internal fields. Here is a small part of this routine.
      MOVE order_header_in-qt_valid_f       TO e_vbakkom-angdt.
      MOVE order_header_in-qt_valid_t       TO e_vbakkom-bnddt.
      MOVE order_header_in-ct_valid_f       TO e_vbakkom-guebg.
      MOVE order_header_in-ct_valid_t       TO e_vbakkom-gueen.
    When I check technical fields for the screen  fields "Valid from" and "Valid to" in VA43 I get names GUEBG and GUEEN. So it still looks like you should use CT_VALID_F and CT_VALID_T.
    I forgot to mention you can still debug BAPI to figure out where the problem is.
    Good luck
    Edited by: Martin Voros on Sep 11, 2009 9:57 AM

  • Adding a summary column in a table which contains the start and end dates in the week

    Hi,
    I've got a DIMENSION DATE table and want to add in another column which shows the start and end date of the week.
    See below, the new column is WEEKOFYEARTEXT.
    Does anybody know how i may generate this column using SQL and using the existing columns?
    Umar Javed

    See:  http://www.sqlusa.com/bestpractices/datetimeconversion/
    DECLARE @Year INT = '2015';
    WITH cteDays AS (SELECT DayOfYear=Dateadd(dd, number,
    CONVERT(DATE, CONVERT(char(4),@Year)+'0101'))
    FROM master.dbo.spt_values WHERE type='P'),
    CTE AS (SELECT DayOfYear, WeekOfYear=DATEPART(week,DayOfYear)
    FROM cteDays WHERE YEAR(DayOfYear)= @YEAR)
    SELECT WeekOfYear, StartOfWeek=MIN(DayOfYear), EndOfWeek=MAX(DayOfYear)
    FROM CTE GROUP BY WeekOfYear ORDER BY WeekOfYear;
    WeekOfYear StartOfWeek EndOfWeek
    1 2015-01-01 2015-01-03
    2 2015-01-04 2015-01-10
    3 2015-01-11 2015-01-17
    4 2015-01-18 2015-01-24
    5 2015-01-25 2015-01-31
    6 2015-02-01 2015-02-07
    7 2015-02-08 2015-02-14
    8 2015-02-15 2015-02-21
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • What is the difference between start() and run()

    Hi:
    what is the difference between start() and the run()???
    in my app, i have
    Console.debug( "starting thread to listen for clients" );
    _server = new Server( this );
    _server.start();
    _server extends Thread..
    why everytime i use server.start(); my app will terminate on it is own, even though in my servr.run() method, i have a while loop
    and if i call _server.run() explicitly in my code, that while loop will be in execution
    can someone let me know??
    thnx

    what is the difference between start() and the
    run()???start() is a method on Thread that tells it to start.
    run() is a method in the object that the thread executes.
    why everytime i use _server.start(); my app will
    terminate on it is own, Err.... I'm not convinced this is true. It'll throw an IllegalThreadStateException, if you try to restart an existing thread.
    If that's what you're saying.
    even though in my _servr.run()
    method, i have a while loopI don't see the connection. Are you saying that the while loop never terminates, and you don't see why the thread is terminating?
    and if i call _server.run() explicitly in my code,
    that while loop will be in executionIf you call server.run() explicitly, then run() will be executed in the same thread that you called it in.

  • Calculate the working days having the start and end dates only

    Hi,
    Can BIP be able to calculate the working days having the start and end dates only? It is like the NETWORKDAYS function in Excel. (i.e. excluding weekends and holidays).
    Thanks.

    Not out of the box.
    But You could extend your BIP functions
    Look at here:
    http://blogs.oracle.com/xmlpublisher/2009/05/bip_by_extension.html
    Based on that what you need is similar to the following Java code:
    http://objectlabkit.sourceforge.net/
    regards
    Jorge A.

  • Getting the start  and end dates of the week

    Hi,
    I was stuck with a problem in getting the start date and end date of the week,i know the month ,week and year also,with these three values how can i get the start and end dates of a week.please help me
    Thanks

    There is no simple way. It has to be a math calculation.
    There are several ways you can get the dates. First you have to know what day is January 1st and what day is december 31st for a particular year. Second you have to check whether the given year is a leap year or not. Based on the abvove information you should be able to find out what day is a particular date.
    Hope this helps to get you started.
    - Venkat Dhurjati.

  • Define the start and end dates of an assigned academic period in fee calc.

    Define the start and end dates of an assigned academic period
    Message no. HRPIQ00ACCOUNTING132
    Diagnosis
    The academic calendar assigned to the top organizational unit does not contain a start or end date for the academic period (academic year and session) assigned to fee calculation period Z000.
    System Response
    The system will skip fee calculation period Z000 and continue processing with the next fee calculation period.
    Procedure
    1. Check which academic calendar is assigned to the top organizational unit.
    2. Check which academic period is assigned to fee calculation period Z000. You check this setting in Customizing for Campus Management in the IMG activity Assign Academic Years and Sessions to Fee Calculation Periods.
    3. In this academic calendar, create the start and end dates of the relevant academic period using standard time limit 0100 (standard duration of academic period) or a corresponding user-defined time limit.
    For more information, see
    Define Top Organizational Unit
    Define Mandatory Time Limits for Academic Calendar
    please give me the needful information to solve this problem.
    Regards
    Arun Rai

    Arun,
    Have you looked in the Student Accounting Cookbook  
    http://www.sdn.sap.com/irj/scn/advancedsearch?query=studentaccountingcookbook   on page 13? 
    Page 1-18 will help you setup the Oranizational unit, the academic calendar and the modules.
    Bev beck

  • How to find the start and ending dates of a quarter of a particular fiscal

    Hi Experts,
    I need a function mudule which returns starting and ending date s of a particular quarter of a particular fiscal year .
    For Example: if pass 1 quarter and 2002 or 2 quarter 2002 it has to give me the star and end dates of that particular quarter na d fiscal year.
    Please help me which is urgent for me.

    Hi Kishan thanks for reply.
    But given function module the 2nd one is full but it is giving me the calender year dates but i need fiscal yea dates.
    fro example: if i pass 1 st quarte and 2006 it is to give me the 1st-april to 30-jun2006.
    And need this quater starting date and ending date for as per USA fiscal year calender.
    If u get any idea plz let me know.
    thanks.
    Dashmantha.

  • FM to find week start and end date on the basis of a given date

    Hi Everyone,
    I have a requirement in which I require the week start and end date  of any given date.
    For eg: The given date is Wednesday 24.03.2010, I need a function module to calculate the week start date ie. Monday 22.03.2010 and week end date ie. Sunday 28.03.2010 on the basis of that date.
    Any input to this query would be helpful.
    Thanks,
    Nimisha Agarwal
    Edited by: Nimisha Agarwal on Jul 7, 2010 7:47 AM

    HI nimisha,
    many posts r there for this .
    Kindly check  before posting
    anyways this FM will serve u  r purpose.
    GET_WEEK_INFO_BASED_ON_DATE

  • Hyperion Planning dynamic forms based on start and end date across years

    Hi All,
    I have a requirement where i need to be able to view a form showing periods across years that are dynamically built depending on the start and end dates. If i have a start date of 01/11/2009 and an end date of 31/7/2013 i want to be able to view a form that shows all of the periods (Jan,Feb etc) in a form that is driven by these dates, in addition it will need to show the actual scenario up to the current month and the forecast from the current month to the end date. So basically if a user inputs the start and end dates the form will display the relevant periods driven by these dates.
    Any tips very much appreciated!

    Hello,
    This is difficult to realize, but you can get quite far with a workaround. The first question is, where do you want to input your selection of time periods? Assuming you have a webform with the complete timeline in months and years and you type in the start period and end period.
    Webforms have the option to suppress rows and columns.
    This can be extended with option of empty cells or not empty cells.
    You will need to apply your creativity on this.
    Put every month-year combination in a column and add the suppression.
    Calculate the timeline between start period and end period with a dummy member, so data exists for these and columns will show.
    Maybe you will need to copy the required timeline into a separate version for this, to avoid having periods which were outside the selection and still have data.
    I hope these hints help a bit in this challenge.
    Regards,
    Philip Hulsebosch
    www.trexco.nl

  • Start and End Dates check

    Hi,
    I have a requirement to find the list of persons who have overlapping dates.
    Each person can have many start and End Dates, but only one row that has a NULL end date, the active record. If the start and end dates are overlapped, like in the example below, the second row should have a start date of 24-DEC-2006 and not 22-DEC-2006. Is it possible to list those persons who have overlapping dates/gap in the dates.
    Empl_ID Start Date End Date
    12345 01-JAN-2006 23-DEC-2006
    12345 22-DEC-2006 13-JAN-2007
    12345 14-JAN-2007 NULL
    Any help is greatly appreciated.
    Thanks!

    Hi Patrick
    I like where you are coming from. I hope you don't mind but I have extended your idea slightly to add in a PARTITION BY clause to make sure we look at records for the same person. Also, if we LAG to get a previous record shouldn't we LAG the END_DATE and compare it with the current START_DATE?
    LAG(END_DATE,1) OVER (PARTITION BY EMPL_ID ORDER BY START_DATE)
    Doing this, then the results would look like this:
    Empl_ID Start Date End Date Lag Date
    12345 01-JAN-2006 23-DEC-2006 NULL
    12345 22-DEC-2006 13-JAN-2007 23-DEC-2006
    12345 14-JAN-2007 NULL 13-JAN-2007
    This would give the SIGN an issue because in the first record the LAG would be NULL and in the last record the END_DATE would be NULL. So it looks like some manipulation of NULLs has to take place as well which I will deal with later.
    SIGN((LAG(END_DATE,1) OVER (PARTITION BY EMPL_ID ORDER BY START_DATE)) - START_DATE)
    Anytime the difference between the Lag Date and the Start Date is positive this means this is an overlap which means we do need to look for any variance where the SIGN is 1.
    Using the other function, we could use LEAD like this:
    LEAD(START_DATE,1) OVER (PARTITION BY EMPL_ID ORDER BY START_DATE)
    Doing this, then the results would look like this:
    Empl_ID Start Date End Date Lead Date
    12345 01-JAN-2006 23-DEC-2006 22-DEC-2006
    12345 22-DEC-2006 13-JAN-2007 14-JAN-2007
    12345 14-JAN-2007 NULL NULL
    which when combined with SIGN becomes: SIGN((LEAD(START_DATE,1) OVER (PARTITION BY EMPL_ID ORDER BY START_DATE)) - END_DATE)
    This time you would be looking for the SIGN to be -1
    Personally, I think I would prefer the LEAD function because a) there would always be a START_DATE, and b) we could replace all of the possible NULLs with the SYSDATE to get a final calculation like this:
    SIGN(NVL(LEAD(START_DATE,1) OVER (PARTITION BY EMPL_ID ORDER BY START_DATE),TRUNC(SYSDATE)) - NVL(END_DATE, TRUNC(SYSDATE)))
    Based on the current date being 17-NOV-2009, you would now get this result:
    Empl_ID Start Date End Date Lead Date
    12345 01-JAN-2006 23-DEC-2006 22-DEC-2006
    12345 22-DEC-2006 13-JAN-2007 14-JAN-2007
    12345 14-JAN-2007 17-NOV-2009 17-NOV-2009
    Best wishes
    Michael

  • Report for Validity Start and End Date in PO

    Dear All
    Is there any report where I can get PO validity start and end date which user input in addtional data header tab of PO?
    Regards
    Satish Kumar

    Hi,
    Yes, It is available standard report using T-code ME2N - Purchasing Document (PO) Per Document Number, enter the T-code and provide the following input data's are as follows.
    Scope of List                 :  ALV ( for Ms-Excel format report)
    Plant                               :   __________ to __________ (if required)
    Document Date              : ____________ to ___________ (if Required)
    Execute the report shown by default in excel format and if required PO validity start and end data, you have to select Change Layout button and open new window options screen right side field option as Validity Per.Start, Validity Period End, Commutative number field data's are selected and click <--- arrow button and then click bottom tick marked button. Now, the report shown your requirement.
    Hope, it is useful for you,
    Regards,
    K.Rajendran

  • SNP Planned order start and end dates are not calculated correctly

    Hello SNP Guru's
    The SNP planned orders generated after the Heuristics run, have a start and end date based on the Activity Duration (Fixed), while the resource consumption is based on the Bucket Consumption (Variable), which is correct.
    The Activity Duration (Fixed) is based on the BOM Base Quantity. So if the Activity Duration = 1 day, and if the order quantity is more than a day, the start and end dates, still shows as 1 day. So no matter what is the order quantity, the start and end dates is always = 1 day.
    Does anyone have any experience in implementing any code to change the start and end dates on SNP Planned Order?
    Seems like it should work as standard.
    Am i missing something?
    Thanks,
    Mangesh

    Dear Mangesh,
    SNP is a infinite planning tool. If you have defined fixed duration to be 1 DAY in the activity, no matter how many quantity you input for your planned order, the order will last for one day. If the resourced is overloaded, you then run capacity levelling to
    banlance the capacity. What your expected beahavior happens in PPDS planning.
    Claire

Maybe you are looking for