1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Period Issue...

Discussion in 'Oracle Apps Technical' started by jagadekara, Apr 25, 2014.

  1. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    Hi All,

    I need a query to display two periods based on one period.
    If I give 'MAR-12' It should display 'APR-12' and 'SEP-12'
    If I give 'SEP-12' It should display 'OCT-12' and 'MAR-13'
    If I give 'APR-13' It should display 'MAY-13' and 'OCT-13'


    Like this which ever period I give I need Next period to 6 months.

    If I give 'DEC-11' It should display 'JAN-12' and 'JUN-12'

    Please provide solution...
     
  2. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    Hi.
    Try this...
    Code (SQL):


    SELECT
         to_char(dd,'MON-RR') DD ,
         to_char(add_months(dd,1),'MON-RR') start_preiod ,
         to_char(add_months(dd ,6),'MON-RR') end_preiod    
    FROM (SELECT to_date ('DEC-11','MON-RR') dd FROM dual  UNION ALL  
            SELECT to_date ('MAR-12','MON-RR') dd FROM dual  UNION ALL
            SELECT to_date ('SEP-12','MON-RR') dd FROM dual  UNION ALL
            SELECT to_date ('APR-13','MON-RR') dd FROM dual
         );


     
    DD              START_PREIOD    END_PREIOD
    --------------- --------------- ---------------
    DEC-11          JAN-12          JUN-12
    MAR-12          APR-12          SEP-12
    SEP-12          OCT-12          MAR-13
    APR-13          MAY-13          OCT-13


     
     
    jagadekara likes this.
  3. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    You are awesome!

    Thanks Sergey.....