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.

Similar Messages

  • 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.

  • FM to get start and end date when given month

    Hi all,
       can anybody help me if there a FM to get start and end date when given month like 01 for jan.
    Thanks in advance
    Sahitya

    Hi,
    Check this Function Module
    HR_JP_MONTH_BEGIN_END_DATE
    here if you r giving the month u wil get the start date and the end date.
    Hope this helps you.
    Thanks & regards,
    Y.R.Prem Kumar

  • 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

  • URGENT REPORT START AND END DATE

    GUYZ help me how to generate a report with start date and end date, two text item or calendar rpresent start and end date, it will generate only the start to end date... plzz put the code guyss..
    this is my code when i call my report in runtime only in client server .. i want to generate it wit start and end date but dunno newbie ..
    Declare
    v_Rep varchar2 (30);
    repid report_Object;
    begin
    repid:=find_report_object('dept');
    v_rep:=run_report_object(repid);
    end;

    Check this sample Code..
    DECLARE
    pl_id ParamList;
    pl_name VARCHAR2(10) := 'repdata';
    BEGIN
    pl_id := Get_Parameter_List(pl_name);
    IF Id_Null(pl_id) THEN
    pl_id := Create_Parameter_List(pl_name);
    Add_Parameter(pl_id, 'P_STARTDATE', TEXT_PARAMETER,:BLK_CTRL.P_TODATE);
    Add_Parameter(pl_id, 'P_ENDDATE', TEXT_PARAMETER, :BLK_CTRL.P_CURRENCY);
    Add_Parameter(pl_id, 'PARAMFORM', TEXT_PARAMETER, 'NO');
    ELSE
    Destroy_Parameter_List( pl_id );
    END IF
    RUN_PRODUCT(REPORTS, 'D:\MMRROLDL.RDF' ,SYNCHRONOUS, RUNTIME, FILESYSTEM, pl_id ,NULL);
    END;

  • Report execution start and end date/time

    Hi All,
    How can one find execution start and end date/times for all reports? Basically I am looking to see what reports were run on a day, when and how long it took for each to complete.
    Thank you.
    Denis

    Hi,
    The "eul5_batch_reports" holds the data about the scheduled report and if you don't have any so you will not have any data.
    Take a look at "EUL5_QPP_STATS"
    for example:
    select
    qpp.qs_doc_name,
    qpp.qs_doc_details,
    fu.user_name Ran_by,
    qpp.qs_created_date Start_run,
    qpp.qs_doc_owner Doc_owner,
    qpp.qs_num_rows rows_fetch,
    qpp.qs_est_elap_time estimated_time,
    qpp.qs_act_elap_time Run_time,
    qpp.qs_act_cpu_time Cpu_time
    from eul_us.EUL5_QPP_STATS qpp,
    fnd_user fu
    where substr(qpp.qs_created_by,2,10)=fu.user_id
    order by qs_created_date

  • How to determine current period start and end dates

    Hi All,
    If given previous period start date and end date, how to determine current period start date and end date?
    Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
    Can you please suggest an FM to determine the current period dates?
    Thanks & Regards
    Gowthami

    >
    gowthami karunya wrote:
    > If given previous period start date and end date, how to determine current period start date and end date?
    > Suppose if given previous period start and end dates are 12/28/08 - 01/30/09, then current period start date and end date will be 01/30/09 - 02/27/09. (where 12 is the previous period, 28 is the day, 08 is the year......)
    Hello,
    I am assuming you have the Company Code with you & proposing this solution.
    TABLES: bkpf.
    PARAMETERS:
    p_bukrs TYPE bukrs.
    SELECT-OPTIONS:
    s_date FOR bkpf-budat.
    DATA :
    l_perio LIKE bkpf-monat,
    l_poper TYPE poper,
    l_year  LIKE bkpf-gjahr,
    l_spmon TYPE spmon,
    l_periv TYPE periv,
    l_date1 TYPE datum,
    l_date2 TYPE datum.
    CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
      EXPORTING
        companycodeid = p_bukrs
        posting_date  = s_date-high
      IMPORTING
        fiscal_year   = l_year
        fiscal_period = l_perio.
    CONCATENATE l_year l_perio INTO l_spmon.
    * Get the next period
    IF l_perio < 12.
      l_perio = l_perio + 1.
    ELSE.
      l_perio = '01'.
      l_year = l_year + 1.
    ENDIF.
    MOVE l_perio TO l_poper.
    SELECT SINGLE periv INTO l_periv
    FROM t001
    WHERE bukrs = p_bukrs.
    IF sy-subrc = 0.
      CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = l_periv
          i_poper        = l_poper
        IMPORTING
          e_date         = l_date1
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr        = l_year
          i_periv        = l_periv
          i_poper        = l_poper
        IMPORTING
          e_date         = l_date2
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      WRITE: / l_date1, l_date2.
    ENDIF.

  • How to change both start and end dates for an business event (or any object

    Hi all.
    We are in the case to change the validity dates for several business events in training management.
    The special point is that both, start and end date, have to be changed.
    In example, business event 00000001 is valid from 2010.01.01 to 2010.01.31 and shoud be "moved" from 2010.05.01 to 2010.05.31.
    So if i run RHBEGDA0 report to change start date first, it doesn't work propperly because new start date is bigger than old enddate.
    Next thing we thought is to change end date first, using RHGRENZ1, and then change the start date, with the report RHBEGDA0. Problem with this solution is that a business event duration shoud be calculated taking care of free days (weekends and day ofs).
    Is there any better solution for this?
    Thanks in advance for your help.
    Best regards.

    Hi,
    I gueass the best solution is to use PV1A t-code.
    You can write an LSMW for this t-code if the number of business events to be maintained is huge.
    Regards,
    Dilek

  • Reduce Working Days by Emp Start and End Dates

    I'm banging my head trying to get this working. The set-up:
    DimResources table with various employee information including a Start and End Date.
    A Calendar table with FullDate, Year, Quarter....WorkingDays (1 for working and 0 for non-working) and WorkingDayNumber (working days increased by 1, weekends are not).
    Page View report with page view filters for Business, Role, Month, Week, Year.
    In the calculation the denominator is total working days for the period * 8. Works great. Further reduced by any submitted time off. Again, so far so good. The part I'm having trouble with is trying to further reduce total working days by
    the number of days the person wasn't available in a month, defined by the person's start or end date.
    The calculated field works great when only 1 person is selected. As soon as more than 1 person is selected or the slicer is cleared, an error is thrown.
    Any ideas on what is wrong or better ways to accomplish what's needed?
    TotalWorkingDays2CF=CALCULATE
     SUM(Calendar[WorkingDays]),
                    FILTER(Calendar,Calendar[WorkingDays]=1),
                    Calendar, DATESBETWEEN(Calendar[FullDate],SUM(DimResources[Start Date]),SUM(DimResources[End Date]))
    Error:
    <detail>
      <ErrorCode>rsErrorExecutingCommand</ErrorCode>
      <Message>Query couldn't run for dataset 'Tablix41DataSet'.</Message>
      <ProductName>Power View</ProductName>
      <ProductVersion>11.0.2150.3</ProductVersion>
      <MoreInfo>MdxScript(Model) (10, 27) Calculation error in measure 'Calendar'[TotalWorkingDays2CF]: An invalid numeric representation of a date value was encountered.</MoreInfo>
    </detail>
    Dennis DeRobertis

    ok, but this is not a running total but just a sub-total/grand-total
    so what you can do is the following:
    create two measures - first calculate the workdays per ressourcen and second use SUMX() to get the sub-/grand-total if multiple employees are selected (e.g. subgroups, groups,division, etc)
    WorkdaysRessource:=CALCULATE(
    COUNTROWS('Date'),
    FILTER('Date',
    'Date'[Date] >= CALCULATE(MIN('DimResources'[Start Date]))
    && 'Date'[Date] <= CALCULATE(MIN('DimResources'[End Date])))
    Workdays:=CALCULATE:=SUMX(
    'DimResources',
    [WorkdaysRessource]
    hth,
    gerhard
    Gerhard Brueckl
    blogging @ http://blog.gbrueckl.at
    working @ http://www.pmOne.com

  • 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.

  • Product View - Start and End dates

    Hi,
             I have a material that is externally procured from a vendor to a location. In product view, I have few purchase requisitions. When i double click on it, it takes me to the details of PR. I am trying to understand what start and end dates of the PR are.
    For some PRs, the start and end dates are same but for some there are is some times a day or two and even 3 in some cases.
    I am wondering what makes the end date differ from start date.
    There is a safety day's supply of 2.5 days
    We have a transportation lane with transportation duration 23hrs.
    Any of these play any role in the end date delay?

    Hi,
          Thanks for the reply. The vendor and the receiving location have a transportation lane defined.
    What do you mean by the  time duration that shows up in the T Lane corresponding to the inforecord?
    Here are the times I see in transportation Lane;
    Product Specific Transportation lane:
    GR processing times (checked) : (No value defined) days
    Planning Horizon: 0 days
    Partner Horizon: 0 days
    Horizon for Expctd receipts: 0 days
    Horiz. Fut. Aval. Whse Stck: 0 days
    Planned Delivery time:  (No value Defined)
    Means of Transport
    Tsp. duration: 23 hrs
    Bucket offset: 0.5
    Period factor: 0.5
    and no other times defined.
    Are any of these effect the delay?
    My ECC is EST and the timestream is EST. Should I change the product view (also my own data) to EST or UTC??
    I have a product that has no delay between the start and end dates. The difference I see between the one that I am having problem (the start and end dates are apart ( I'm calling it bad one) by atleast a day) with and the one that has no delay(I'm calling this good one) between the start and end dates is the "Planned Delivery time.
    The good one has 1 day and the bad one has nothing defined.
    Does this make any difference?
    Thanks.
    Edited by: Raj G on Jul 17, 2008 3:36 PM

  • Effective start and end dates for a compensation workbench plan

    Hi all,
    We are having a requirement where we want to get the data respective to current plan for reporting purposes. What i have noticed is there is no such thing as effective_start_date and effective_end_date directly in all the cwb tables.
    The different dates we are looking at to capture the data are
    enrt_perd_start_dt and enrt_perd_end_dt
    upd_strt_dt and upd_end_dt
    within_yr_strt_dt and within_yr_end_dt
    But we have same plan with different enrollment period and start dates. We are planning to use max(data_freeze_date or lf_evt_occrd_dt) to get
    the records.
    select max(nvl(bcpdx.data_freeze_date, bcpdx.lf_evt_ocrd_dt))
    from ben_cwb_pl_dsgn bcpdx
    where bcpdx.pl_id = p_pl_id)
    Catch with this is, We have 62 business groups off which only 50 might run the plan next year and ohters might not. in that case it will also return data for all the BG's including the 12 BG's where plan has not been run for that year.
    Any suggestions or help will greatly be appreciated.
    Thanks
    Hari

    Hi Ankush,
    I am also of the same opinion. Start and end dates can probably be enforced by a policy condition in AM but would lead to proliferation of policies as we would end up creating policies per role entitlement duration for a user.
    Any thoughts on whether the sunrise/sunset concept of Identity Manager can be used for this requirement.
    Thanks,
    Srinivas

Maybe you are looking for