partitioning in 11g by year and month

Hello

I use oracle 11g and oracle 9i database data migration.
9i has given since 2001 until 2010 Leave a how about every year will be 12 million records, monthly around 1 M

11 g, must now create this annual partion table from 2001 to 2009
and since 2010 Jan leave the partition should be monthly and is expected to grow automatically.

How do I create partion table annual (2001 to 2009) and a monthly interval partion (2010 Jan go and grow) in 11g?

Here is the sample table for an eg..


-- this is for 2010
create table sales
(
   sales_id    number,
   sales_dt    date
)
partition by range (sales_dt)
interval (numtoyminterval(1,'MONTH'))
(
   partition p001 values less than (to_date('2010-02-01','yyyy-mm-dd'))
   partition p002 values less than (to_date('2010-03-01','yyyy-mm-dd'))
);

In fact, it should be:

create table sales
(
   sales_id    number,
   sales_dt    date
)
partition by range (sales_dt)
interval (numtoyminterval(1,'MONTH'))
(
   partition p001 values less than (date '2002-01-01'),
   partition p002 values less than (date '2003-01-01'),
   partition p003 values less than (date '2004-01-01'),
   partition p004 values less than (date '2005-01-01'),
   partition p005 values less than (date '2006-01-01'),
   partition p006 values less than (date '2007-01-01'),
   partition p007 values less than (date '2008-01-01'),
   partition p008 values less than (date '2009-01-01'),
   partition p009 values less than (date '2010-01-01')
)
/

SY.

Tags: Database

Similar Questions

  • Time of year and month to generate

    Hello

    How can I generate years and months certain period, by using a single query

    Example: I would like to generate every month between 2010 and 2012, it shows

    201001

    201002

    ...

    ..

    201012

    201101

    201102

    ..

    201112

    201201

    201202

    201203

    ....

    ....

    201212

    How can I make using query without using cursor?

    TIA

    using

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    PL/SQL Release 11.2.0.4.0 - Production

    CORE Production 11.2.0.4.0

    AMT for Linux: Version 11.2.0.4.0 - Production

    NLSRTL Version 11.2.0.4.0 - Production

    So, technically... you always use a cursor.

    Select add_months (date ' 2010-01-01', rownum-1)

    OF the double

    connect add_months (date ' 2010-01-01', rownum-1)<= date="">

    /

    would give you a start every day of a month of 01/2010 to 12/2012 as a DATE!

    HTH

  • How to filter the blog by year and month not only? Please help ASAP!

    Hey everybody!

    Does anyone know any code so that I can filter by year in the catalyst for business blog feature? at the moment I can do only a month.

    Quick help would be greatly appreciated!

    Thank you!

    James

    Hi James,

    Are you talking about so there blog post filtering filtered by year?

    If so I suggest to create tags for 'years' and then assign the ticket to blog as a result.

    Once completed, it will appear like this on the front-end server in your overall layout of blog.

    I hope this helps!

    -Sidney

  • Extract data based on the year and month

    My clients have taken a field TimeStamp DB Oracle and downloaded the access in a TEXT field format.
    Samples: 20060401001348CS

    Everything I'm doing is extracted from the data based on the year and the month. I equal to 200604 *, 200604%. Have also tried to use AS.
    Nothing works. It may just be that dificult. Help, please. Thank you

    Mike

    I'm SO sorry. I have 35 years of Experinece in this area and I have my data (assuming) was all a 200604 date and he was not. The query did work. I'll have more questions and that you do not want to loose credability with this site. Again, I am sorry. Sincere to help thanks.
    Ron

  • I have problems with D4.1 in Labview ' 09. It is said to determine the age of a person in years, when given the month in course, day, and year and month of birth of the person, day, and year

    Seen someone's birth month day and year... and also the day of the current month and year like entries... calculate their age, years... as output... age should not increment by one until the arrival of their birthday this year.   I can't get the coding right... Please help


  • Count the days back by year and month?

    In my doc, I have 7 text fields (Sun, Mon, Mar, sea, game, Fri, SAT). I use another field enter a date. When I enter an end date, I have 7 fields to be filled with dates. For example, if I enter the date field 06 18, 2016, I wish I had the 7 fields like this, Sun would show 12, Lun would show 13, AUT show 14, sea would indicate 15, game show 16, Fri would show 17 and Sam would have 18. I'm counting the days is backwards because I'm coming the weekend of date (always a Saturday).

    What I'm running is the month before sometimes will have 30 days, some months have 31 (and of course leap years). Thus, for example, if I choose 2 July 2016 days should come back like that, Sun should see 26, LUNs should show 27, Tue should show 28, sea should show 29, that game should show 30, Fri should show 01, Sam should show July 02.

    How can I do this correctly? I need a javascript smart thing to do. Can someone please help me with an example? Thank you.

    Here is a link to a sample form that shows how you can do this: http://acroscript.net/pdf/demos/populateWeek.pdf

    The script is located in the field Validate event entry date. Note that day fields use a special naming convention that allows a simplification of the code, so you have to use a similar model.

  • How to get the year and month of a whole year

    Hello

    I have a list of selection and when the user selects the list values are like this 201101,201102,201103

    I tried like this


    declare
    T_DATE varchar2 (25);
    Start
    because me in 1.12 loop
    Select TO_CHAR (ADD_MONTHS (SYSDATE, + 1), "YYYYMM") in the double T_DATE;
    dbms_output.put_line (V_DATE);
    end loop;
    end;

    But its bad and I can not get clear idea where to change the code

    Thanks and greetings
    Srikkanth.M

    Srikkanth.M wrote:
    Hello

    I have a list of selection and when the user selects the list values are like this 201101,201102,201103

    If you want to list for the current year from Jan 201101,201102, 201103... 201112, then try this

    DECLARE
      v_Date  VARCHAR2(25);
      n_month NUMBER;
    BEGIN
      SELECT extract (MONTH FROM sysdate) INTO n_month FROM dual;
      FOR i IN 1..12
      LOOP
        SELECT TO_CHAR(ADD_MONTHS(SYSDATE, (i-n_month)), 'YYYYMM')
        INTO v_date
        FROM dual;
        dbms_output.put_line(v_date);
      END LOOP;
    END;
    

    Vivek L

  • GregorianCalendar adding year and month

    Hi all

    I am trying to create a package using Gregorian calendar where I expect a result comparable to 20101029 (YYYYMMDD)

    So I created a code

    / code

    package com.cera.hyperionUtils;
    Import Java.util;

    public class HypDate {}

    public static int yearmonthday (Field1 int)
    {
    1 declare the calendar
    Calendar c = new GregorianCalendar();
    c.setLenient (true);

    2 perform operations
    3. extract and return the result
    int = Calendar.YEAR field * 10000 + Calendar.MONTH * 100 + Calendar.DAY_OF_MONTH;
    Return c.get (field);
    }

    Public Shared Sub main (String [] args)
    {
    System.out.println (HypDate.yearmonthday (1));

    }
    }

    / code

    But then it gives me an error.

    Can someone help me with this?

    Published by: Madeleine Kattookaran, 28 October 2010 13:23

    1. in the validation of code, surround with [code] and [/ code] (without the spaces within the brackets). Use the Preview tab to view the appearance before submitting your message.

    2. you must be precise, complete and clear in your requirements. It is difficult for people who will help you if you their capture.

    It is not really clear what you mean by "add an option where the user can choose. Do you mean they get specify everything they want? Or you're going to give them a selection of a few to choose? In one case, I don't see where is the problem. If you know how to use SimpleDateFormat with a specific format string, then you know how to use it with other institutions.

    Obviously, you will have to change

    public static final String DATE_FORMAT_NOW = "yyyyMMdd";
    

    something which sets the string format correctly when it is selected or entered.

  • Year and month display

    Hello

    I need display the date format MONTH-YYYY in a SQL query, the query Condition is like that

    If I run the query today it should show from May to November 2012 (IE interval of 6 months)

    If I run the same question next month must show Jun-2012 December 2012 (IE interval of 6 months)

    Based on the date system, should it complete the date rate please suggest me how to get these date ranges.

    Thank you
    Sudhir
    /* Formatted on 2012/05/22 15:02 (Formatter Plus v4.8.8) */
    SELECT TO_CHAR (SYSDATE, 'MON RRRR'), TO_CHAR (ADD_MONTHS (SYSDATE, 6), 'MON RRRR')
      FROM DUAL;
    
  • how every 3 months a year and the dynamics of group a new column?

    I have a sql that allows to display the folders below.
    YEARS MONTHS SUMMONTH SUMYEAR
    ----- ------ -------- -------
     2009 Apr      130288 1720164 
     2009 Aug      138776 1720164 
     2009 Dec      140294 1720164 
     2009 Feb      136422 1720164 
     2009 Jan      148253 1720164 
     2009 Jul      149842 1720164 
     2009 Jun      122805 1720164 
     2009 Mar      145872 1720164 
     2009 May      151193 1720164 
     2009 Nov      133487 1720164 
     2009 Oct      169443 1720164 
     2009 Sep      153489 1720164 
     2010 Apr      142255 1719457 
     2010 Aug      135894 1719457 
     2010 Dec      171203 1719457 
     2010 Feb      137011 1719457 
     2010 Jan      145493 1719457 
     2010 Jul      137474 1719457 
     2010 Jun      154411 1719457 
     2010 Mar      133062 1719457 
     2010 May      146887 1719457 
     2010 Nov      139869 1719457 
     2010 Oct      127191 1719457 
     2010 Sep      148707 1719457 
    
     24 rows selected 
    The SQL code that I use:
    select years, months, summonth, sumyear
    from(
    select years, months, SUM (sumHour) OVER (PARTITION BY years,months) sumMonth, SUM (sumHour) OVER (PARTITION BY years) sumyear
    from (SELECT x.years, x.months, x.days, x.hours, x.mins, sum(x.value) as sumHour
    FROM xmltest, 
    XMLTABLE ('$d/cdata/name' passing xmldoc as "d" 
       COLUMNS 
      years integer path 'year',
      months varchar(3) path 'month',
      days varchar(2) path 'day',
      hours varchar(2) path 'hour',
      mins varchar(2) path 'minute',
      value float path 'value'
      ) as X 
      group by x.years, x.months, x.days, x.hours, x.mins
      order by x.years, x.months, x.days
      )
      )
      group by years,months,summonth,sumyear
      order by years
    and now the problem of problems can group the sum of 3 months of recording as a quarter of the year in a dynamic column?

    The display should be seydou this:
    YEARS MONTHS SUMMONTH SUMQUARTER SUMYEAR
    ----- ------ -------- ---------- -------
     2009 Feb      136422     430547 1720164 
     2009 Jan      148253     430547 1720164 
     2009 Mar      145872     430547 1720164 
     2009 Apr      130288     404286 1720164 
     2009 Jun      122805     404286 1720164 
     2009 May      151193     404286 1720164 
     2009 Aug      138776     442107 1720164 
     2009 Jul      149842     442107 1720164 
     2009 Sep      153489     442107 1720164 
     2009 Dec      140294     443224 1720164 
     2009 Nov      133487     443224 1720164 
     2009 Oct      169443     443224 1720164 
     2010 Feb      137011     415566 1719457 
     2010 Jan      145493     415566 1719457 
     2010 Mar      133062     415566 1719457 
     2010 Apr      142255     443553 1719457 
     2010 Jun      154411     443553 1719457 
     2010 May      146887     443553 1719457 
     2010 Aug      135894     422075 1719457 
     2010 Jul      137474     422075 1719457 
     2010 Sep      148707     422075 1719457 
     2010 Dec      171203     438263 1719457 
     2010 Nov      139869     438263 1719457 
     2010 Oct      127191     438263 1719457 
    
     24 rows selected 
    Thanks everybody helps me. !!

    may be using an external selection:

    SQL> with sample_tab as
      2  (
      3  select  2009 year, 'Aug' month, 138776 summonth , 1720164  sumyear from dual union all
      4  select  2009,'Apr',130288,     1720164 from dual union all
      5  select  2009,'Dec', 140294 , 1720164  from dual union all
      6  select  2009,'Feb', 136422 , 1720164  from dual union all
      7  select  2009,'Jan', 148253 , 1720164  from dual union all
      8  select  2009,'Jul', 149842 , 1720164  from dual union all
      9  select  2009,'Jun', 122805 , 1720164  from dual union all
     10  select  2009,'Mar', 145872 , 1720164  from dual union all
     11  select  2009,'May', 151193 , 1720164  from dual union all
     12  select  2009,'Nov', 133487 , 1720164  from dual union all
     13  select  2009,'Oct', 169443 , 1720164  from dual union all
     14  select  2009,'Sep', 153489 , 1720164  from dual union all
     15  select  2010,'Apr', 142255 , 1719457  from dual union all
     16  select  2010,'Aug', 135894 , 1719457  from dual union all
     17  select  2010,'Dec', 171203 , 1719457  from dual union all
     18  select  2010,'Feb', 137011 , 1719457  from dual union all
     19  select  2010,'Jan', 145493 , 1719457  from dual union all
     20  select  2010,'Jul', 137474 , 1719457  from dual union all
     21  select  2010,'Jun', 154411 , 1719457  from dual union all
     22  select  2010,'Mar', 133062 , 1719457  from dual union all
     23  select  2010,'May', 146887 , 1719457  from dual union all
     24  select  2010,'Nov', 139869 , 1719457  from dual union all
     25  select  2010,'Oct', 127191 , 1719457  from dual union all
     26  select  2010,'Sep', 148707 , 1719457  from dual
     27  )
     28  select year,
     29         month,
     30         summonth,
     31         sum(summonth) over(partition by year || to_char(ym, 'Q') order by year || to_char(ym, 'Q')) sumquarter,
     32         sumyear
     33    from (
     34          select year,
     35                  month,
     36                  summonth,
     37                  sumyear,
     38                  to_date(year || month, 'YYYYMon') ym
     39            from sample_tab)
     40   order by ym
     41  ;
    
          YEAR MONTH   SUMMONTH SUMQUARTER    SUMYEAR
    ---------- ----- ---------- ---------- ----------
          2009 Jan       148253     430547    1720164
          2009 Feb       136422     430547    1720164
          2009 Mar       145872     430547    1720164
          2009 Apr       130288     404286    1720164
          2009 May       151193     404286    1720164
          2009 Jun       122805     404286    1720164
          2009 Jul       149842     442107    1720164
          2009 Aug       138776     442107    1720164
          2009 Sep       153489     442107    1720164
          2009 Oct       169443     443224    1720164
          2009 Nov       133487     443224    1720164
          2009 Dec       140294     443224    1720164
          2010 Jan       145493     415566    1719457
          2010 Feb       137011     415566    1719457
          2010 Mar       133062     415566    1719457
          2010 Apr       142255     443553    1719457
          2010 May       146887     443553    1719457
          2010 Jun       154411     443553    1719457
          2010 Jul       137474     422075    1719457
          2010 Aug       135894     422075    1719457
    
          YEAR MONTH   SUMMONTH SUMQUARTER    SUMYEAR
    ---------- ----- ---------- ---------- ----------
          2010 Sep       148707     422075    1719457
          2010 Oct       127191     438263    1719457
          2010 Nov       139869     438263    1719457
          2010 Dec       171203     438263    1719457
    
    24 rows selected
    
    SQL> 
    
  • can you help to reset the iPhone 6 +? used of the year and the month. Now, when you update, it asks activation and I can't remember anything! Arouca and verification is in stock

    can you help to reset the iPhone 6 +? used of the year and the month. Now, when you update, it asks activation and I can't remember anything! Arouca and verification is in stock

    To activate you need your Apple ID and password. If you forgot their date on https://iforgot.apple.com.

  • Why my display of the date of the mailbox does not have a / between the year and the month?

    I'm talking here about how the date of different e-mails appear in my Inbox. I have a / between the month and the day, and a / after the day, but I did not / between the year and the month.

    TB uses the date format short, such that defined by your operating system, which, in the case of Windows, is located in the Panel control/region and language.

    http://KB.mozillazine.org/Date_display_format

    There are a few modules that might also be useful:

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ConfigDate/

    https://addons.Mozilla.org/en-us/Thunderbird/addon/Super-date-format/

    http://chrisramsden.vfast.co.UK/3_How_to_install_Add-ons_in_Thunderbird.html

  • I got a virus last year and tried to remove it for months, it's a virus IMPOSSIBLE!

    : Origin IMPOSSIBLE the virus!

    I got a virus last year and tried to remove it for months had to leave and walk away to keep my sanity! VAIO and OS is vista!

    I get a BSOD and only able to boot in safe mode!

    It only doesn't let me do a system restore (even command line)

    I run rkill it finds nothing...

    EACH SPY software removal

    I went through tons to fix!

    I would LIKE a RESPONSE or any kind of help! I miss my laptop!

    Hello

    Run everything first is that there is no rootkits that can survive a re-installation of Windows.

    TDSSKiller.exe. - Download the desktop - so go ahead and right-click on it - RUN AS ADMIN
    It will show infections in the report after the execution.
    http://support.Kaspersky.com/viruses/solutions?QID=208280684

    Check with Sony support for the methods to restore the laptop back to the form of the plant which removes
    all programs and data, save the data off the computer and get ready to re - install the
    programs.

    Sony - Contacts
    http://eSupport.Sony.com/us/Perl/contact-land.pl

    Sony - drivers
    http://eSupport.Sony.com/Perl/select-System.pl

    Sony - Support
    http://eSupport.Sony.com/

    Sony - Forum
    https://Forum.sel.Sony.com/?XID=M:Showcase:eSupport

    I hope this helps and happy holidays!

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • How to calculate the year last month in obiee 11g?

    Hello

    I want to calculate the year last month in obiee 11g. I tried DB.

    -SELECT TO_CHAR (ADD_MONTHS (SYSDATE,-12), 'YYYYMMDD') FROM DUAL;

    Using the above query, year last month is -"08-01-2015"

    But I want to get the same result using timestampadd() in obiee 11g.

    Please help me,

    Thanks in advance,

    A.Kavya

    Hello

    TIMESTAMPADD (SQL_TSI_YEAR-1, CURRENT_DATE)

  • My license stops on 3 oct. I didn't want another year and remove Photoshop CC. stupid I know, but now I want to start in October, but I don't know how Adobe to know I want to pick up Adobe Creative cloud approx. PS and LR 12.09 each month

    My license stops on 3 oct. I didn't want another year and remove Photoshop CC. stupid I know, but now I want to start in October, but I don't know how Adobe to know I want to pick up Adobe Creative cloud approx. PS and LR 12.09 each month

    Go to your account and extend your subscription, Adobe ID

    reinstall your cc desktop application, https://creative.adobe.com/products/creative-cloud and use it to install your ps and lr

    [left the show Creative cloud download &install]

Maybe you are looking for