SUBPARTITION template

Is it possible to modify the subpartition template of the table which has got data.
I want to add one more value to SUBPARTITION of the template.
SUBPARTITION TEMPLATE
  (SUBPARTITION PRD VALUES ('303', '660', '148', '150') TABLESPACE TEST,
   SUBPARTITION PRD1 VALUES ('238', '76') TABLESPACE TEST,
CREATE TABLE SYSADM.TEST1
  BUSINESS_UNIT       VARCHAR2(5 BYTE)          NOT NULL,
  FI_INSTRUMENT_ID    VARCHAR2(20 BYTE)         NOT NULL,
  FI_IBALTYPE_CD      VARCHAR2(10 BYTE)         NOT NULL,
  ASOF_DT             DATE,
  ASOF_STATUS         VARCHAR2(2 BYTE)          NOT NULL,
  FI_BALANCE_AMT      NUMBER(18,3)              NOT NULL,
  FI_BALANCE_BCE_AMT  NUMBER(18,3)              NOT NULL,
  FI_ACCRINT_AMT      NUMBER(18,3)              NOT NULL,
  FI_ACCRINT_BCE_AMT  NUMBER(18,3)              NOT NULL,T
  CURRENCY_CD         VARCHAR2(3 BYTE)          NOT NULL,
  BASE_CURRENCY       VARCHAR2(3 BYTE)          NOT NULL,
  FI_LST_PAYMNT_DT    DATE,
  PROCESS_INSTANCE    NUMBER(10)                NOT NULL
TABLESPACE TEST
LOGGING
PARTITION BY RANGE (AS_DT)
SUBPARTITION BY LIST (BUSINESS_UNIT)
SUBPARTITION TEMPLATE
  (SUBPARTITION PRD VALUES ('303', '660', '148', '150') TABLESPACE TEST,
   SUBPARTITION PRD1 VALUES ('238', '76') TABLESPACE TEST,
  PARTITION JUN_2011 VALUES LESS THAN (TO_DATE(' 2011-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    NOLOGGING
    NOCOMPRESS
    TABLESPACE TEST
  ( SUBPARTITION JUN_2011_PRD VALUES ('303', '660', '148', '150')    TABLESPACE TEST,
    SUBPARTITION JUN_2011_PRD1 VALUES ('238', '76')    TABLESPACE TEST
  PARTITION JULY_2011 VALUES LESS THAN (TO_DATE(' 2011-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    NOLOGGING
    NOCOMPRESS
    TABLESPACE TEST
  ( SUBPARTITION JULY_2011_PRD VALUES ('303', '660', '148', '150')    TABLESPACE TEST,
    SUBPARTITION JULY_2011_PRD1 VALUES ('238', '76')    TABLESPACE TEST,
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;

Please do not multi-post.
https://community.oracle.com/thread/2617016
https://community.oracle.com/thread/2617018
https://community.oracle.com/thread/2617024

Similar Messages

  • Subpartition templates and DBMS_Metadata.Get_DDL

    Does anyone know of a way to get DBMS_Metadata.Get_DDL to specify a subpartition template clause instead of spitting out a specification for every subpartition? I'm finding a 6,000 line create table statement to be a little unwieldy ...
    This is 10.2.0.4

    Does anyone know of a way to get DBMS_Metadata.Get_DDL to specify a subpartition template clause instead of spitting out a specification for every subpartition? I'm finding a 6,000 line create table statement to be a little unwieldy ...
    This is 10.2.0.4

  • How to add subpartitions to the existing subpartition template

    Hi All,
    My Question is ,how to add Subpartition to the exiting subpartition template. e
    like i have created a table with subpartition template with with 5 subpartitions like
    subpartiton one_1 value (121)
    subpartition two_2 value(122)
    and now i one to add one more subpartitin to the existing subpartition template(Like modify the existing subpartition templete).
    subpartition three_3 value(123)
    Could any suggest me.
    Thanks
    Sree

    >
    My Question is ,how to add Subpartition to the exiting subpartition template.
    >
    Follow the example in the section for 'Modifying a Subpartition Template' in the VLDB and Partitioning Guide
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007904
    >
    You can modify a subpartition template of a composite partitioned table by replacing it with a new subpartition template. Any subsequent operations that use the subpartition template (such as ADD PARTITION or MERGE PARTITIONS) now use the new subpartition template. Existing subpartitions remain unchanged.
    If you modify a subpartition template of an interval-* composite partitioned table, then interval partitions that have not yet been created use the new subpartition template.
    Use the ALTER TABLE ... SET SUBPARTITION TEMPLATE statement to specify a new subpartition template. For example:
    ALTER TABLE emp_sub_template
    SET SUBPARTITION TEMPLATE
    (SUBPARTITION e TABLESPACE ts1,
    SUBPARTITION f TABLESPACE ts2,
    SUBPARTITION g TABLESPACE ts3,
    SUBPARTITION h TABLESPACE ts4

  • Modify SUBPARTITION TEMPLATE

    Is it possible to change the SUBPARTITION TEMPLATE of the table which has got the data.
    I want to add one more value
    to the subpartiion template.
    SUBPARTITION TEMPLATE
      (SUBPARTITION PRD VALUES ('303', '660', '148', '150') TABLESPACE TEST,
       SUBPARTITION PRD1 VALUES ('238', '76') TABLESPACE TEST,
    complete Table script .
    CREATE TABLE SYSADM.TEST1
      BUSINESS_UNIT       VARCHAR2(5 BYTE)          NOT NULL,
      FI_INSTRUMENT_ID    VARCHAR2(20 BYTE)         NOT NULL,
      FI_IBALTYPE_CD      VARCHAR2(10 BYTE)         NOT NULL,
      ASOF_DT             DATE,
      ASOF_STATUS         VARCHAR2(2 BYTE)          NOT NULL,
      FI_BALANCE_AMT      NUMBER(18,3)              NOT NULL,
      FI_BALANCE_BCE_AMT  NUMBER(18,3)              NOT NULL,
      FI_ACCRINT_AMT      NUMBER(18,3)              NOT NULL,
      FI_ACCRINT_BCE_AMT  NUMBER(18,3)              NOT NULL,T
      CURRENCY_CD         VARCHAR2(3 BYTE)          NOT NULL,
      BASE_CURRENCY       VARCHAR2(3 BYTE)          NOT NULL,
      FI_LST_PAYMNT_DT    DATE,
      PROCESS_INSTANCE    NUMBER(10)                NOT NULL
    TABLESPACE TEST
    LOGGING
    PARTITION BY RANGE (AS_DT)
    SUBPARTITION BY LIST (BUSINESS_UNIT)
    SUBPARTITION TEMPLATE
      (SUBPARTITION PRD VALUES ('303', '660', '148', '150') TABLESPACE TEST,
       SUBPARTITION PRD1 VALUES ('238', '76') TABLESPACE TEST,
      PARTITION JUN_2011 VALUES LESS THAN (TO_DATE(' 2011-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        NOLOGGING
        NOCOMPRESS
        TABLESPACE TEST
      ( SUBPARTITION JUN_2011_PRD VALUES ('303', '660', '148', '150')    TABLESPACE TEST,
        SUBPARTITION JUN_2011_PRD1 VALUES ('238', '76')    TABLESPACE TEST
      PARTITION JULY_2011 VALUES LESS THAN (TO_DATE(' 2011-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        NOLOGGING
        NOCOMPRESS
        TABLESPACE TEST
      ( SUBPARTITION JULY_2011_PRD VALUES ('303', '660', '148', '150')    TABLESPACE TEST,
        SUBPARTITION JULY_2011_PRD1 VALUES ('238', '76')    TABLESPACE TEST,
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;

    Please do not multi-post.
    https://community.oracle.com/thread/2617016
    https://community.oracle.com/thread/2617018
    https://community.oracle.com/thread/2617024

  • SUBPARTITION TEMPLATE modify

    Is it possible to modify the existing SUBPARTITION TEMPLATE. Table has got data.
    I want to add one more value to the SUBPARTITION in the template.
    SUBPARTITION TEMPLATE
      (SUBPARTITION PRD VALUES ('303', '660', '148', '150') TABLESPACE TEST,
       SUBPARTITION PRD1 VALUES ('238', '76') TABLESPACE TEST,
    table script.
    CREATE TABLE SYSADM.TEST1
      BUSINESS_UNIT       VARCHAR2(5 BYTE)          NOT NULL,
      FI_INSTRUMENT_ID    VARCHAR2(20 BYTE)         NOT NULL,
      FI_IBALTYPE_CD      VARCHAR2(10 BYTE)         NOT NULL,
      ASOF_DT             DATE,
      ASOF_STATUS         VARCHAR2(2 BYTE)          NOT NULL,
      FI_BALANCE_AMT      NUMBER(18,3)              NOT NULL,
      FI_BALANCE_BCE_AMT  NUMBER(18,3)              NOT NULL,
      FI_ACCRINT_AMT      NUMBER(18,3)              NOT NULL,
      FI_ACCRINT_BCE_AMT  NUMBER(18,3)              NOT NULL,T
      CURRENCY_CD         VARCHAR2(3 BYTE)          NOT NULL,
      BASE_CURRENCY       VARCHAR2(3 BYTE)          NOT NULL,
      FI_LST_PAYMNT_DT    DATE,
      PROCESS_INSTANCE    NUMBER(10)                NOT NULL
    TABLESPACE TEST
    LOGGING
    PARTITION BY RANGE (AS_DT)
    SUBPARTITION BY LIST (BUSINESS_UNIT)
    SUBPARTITION TEMPLATE
      (SUBPARTITION PRD VALUES ('303', '660', '148', '150') TABLESPACE TEST,
       SUBPARTITION PRD1 VALUES ('238', '76') TABLESPACE TEST,
      PARTITION JUN_2011 VALUES LESS THAN (TO_DATE(' 2011-07-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        NOLOGGING
        NOCOMPRESS
        TABLESPACE TEST
      ( SUBPARTITION JUN_2011_PRD VALUES ('303', '660', '148', '150')    TABLESPACE TEST,
        SUBPARTITION JUN_2011_PRD1 VALUES ('238', '76')    TABLESPACE TEST
      PARTITION JULY_2011 VALUES LESS THAN (TO_DATE(' 2011-08-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
        NOLOGGING
        NOCOMPRESS
        TABLESPACE TEST
      ( SUBPARTITION JULY_2011_PRD VALUES ('303', '660', '148', '150')    TABLESPACE TEST,
        SUBPARTITION JULY_2011_PRD1 VALUES ('238', '76')    TABLESPACE TEST,
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;

    Please do not multi-post.
    https://community.oracle.com/thread/2617016
    https://community.oracle.com/thread/2617018
    https://community.oracle.com/thread/2617024

  • Subpartition Template COMPRESS NOCOMPRESS parameter

    Hi ,
    I'm trying to create a table with subpartitions by list already partitioned by list,
    I want to configure that some of my subpartitions are compressed and the rest nocompressed,
    but I couldn't find how to specify it,
    I could specify if the partition at all is compressed or not but not a subpartition level,
    Thanks in advance

    Hi,
    I'm afraid it's not possible to specify this at the subpartition level at the moment.
    I have logged an enhancement request on this.
    Thanks for reporting this issue,
    David

  • Help to create SUBPARTITIONS

    HI,
    I am getting error while creating a SUBPARTITION for my table.
    CREATE TABLE Tab1
    col1 NUMBER(12),
    col2 CHAR(1 BYTE),
    col3 CHAR(1 BYTE),
    col4 NUMBER(12)
    PARTITION BY LIST (col1 )
    SUBPARTITION BY HASH (col4)
    SUBPARTITION TEMPLATE(
    SUBPARTITION SP_1 TABLESPACE C_D
    PARTITION PAR_0 VALUES (0)
    TABLESPACE C_D
    Error
    SUBPARTITION BY HASH (col4)
    ERROR at line 9:
    ORA-00922: missing or invalid option
    The syntax is all correct... i am not understanding where i am going wrong. Can anyone tell me my mistake.
    Thanks
    Sami

    What Hoek said is correct, at least for 10.2.
    11.2 supports list/hash and your code works as expected (after changing the tablespace to users):
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP, Data Mining
    and Real Application Testing options
    SQL> CREATE TABLE Tab1
      2  (
      3  col1 NUMBER(12),
      4  col2 CHAR(1 BYTE),
      5  col3 CHAR(1 BYTE),
      6  col4 NUMBER(12)
      7  )
      8  PARTITION BY LIST (col1 )
      9  SUBPARTITION BY HASH (col4)
    10  SUBPARTITION TEMPLATE(
    11  SUBPARTITION SP_1 TABLESPACE users
    12  )
    13  (
    14  PARTITION PAR_0 VALUES (0)
    15  )
    16  TABLESPACE users;
    Table created.
    SQL>But you didn't tell us your Oracle version so.....

  • Where did the Partitions and SubPartitions go?

    I created a table with partition Range (Transaction_Date, Retention_Period) and hash (Record_Id) subpartition template (for 32 subpartitions)
    Then I add more partitions and while the loop is going on I can get counts of partitions and subpartitions. The job finished and my log table shows about 1800 partitions added and there should be 32 subpartitions for each of the partitions. However, user_tab_partitions shows zero records for the table, and user_tab_subpartitions also show zero record. After a few minutes the partitions show up but no subpartitions. The indexes on the table have also disappeared (one local and one global)
    Any explanation for this behaviour?
    Working on Exadata 11.2.0.3
    Querying
    USER_TABLES
    USER_TAB_PARTITIONS
    USER_TAB_SUBPARTITIONS
    USER_INDEXES

    >
    Step 1. Create Table xyz (c1 date, c2 integer c3 integer, etc)
    partition by range (c1,c2)
    subpartition template (s01, s02... s32)
    create index i1 on xyz (c1,c2,c3) local;
    Then, since I want to create about 1800 partitions I have a procedure that has a "loop around" ALTER TABLE add Partition .. until all the partitions are created. This is the "Job" which while running I query USER_TAB_PARTITIONS and USER_TAB_SUBPARTITIONS to see how things are progressing. And Yes ALTER Table has no progressing to verify.
    So al the partitions get created. No errors from the procedure to go through creating all the partitions. So I would expect that at the end I should get to see all the new partitions for the Table. Instead I get "no records" from USER_TAB_PARTITIONS and USER_TAB_SUBPARTITIONS.
    I am also aware that "ALTER TABLE ADD PARTITION .." cannot make indexes go away. However, if the query on USER_INDEXES returns nothing, what happend to the Index created before the partitions were added?
    I am not using DBMS_REDEFINITION. The only procedure is to add partitions one at a time for each date for 3 years. If you have a better way than a procedure please advise accordingly.
    >
    In order to help you the first step is to understand what problem you are dealing with. Then comes trying to determine what options are available for addressing the problem. There are too many times , and yours may, or may not, be another one, where people seem to have settled on a solution before they have really identified the problem.
    Anytime someone mentions the use of dynamic SQL it raises a red flag. And when that use is for DDL, rather than DMl, it raises a REALLY BIG red flag.
    Schema objects need to be managed properly and the DDL that creates them needs to be properly written and kept in some sort of version control.
    Scripts and procedures that use dynamic SQL are more properly used to create DDL, not to execute it. That is, rather than use a procedure to dynamically create or alter a table you would use the procedure to dynamically create a DDL script that would create or alter the table.
    Let's assume that you know for certain that your table really needs to have 1800 partitions, be subpartitioned the way you say and have partition and subpartitions names that you assign. Well, that would be a pain to hand-write 1800 partition definitions.
    So you would create a procedure that would produce a CREATE TABLE script that had the proper clauses and syntax to specify those 1800 partitions. Your 'loop' would not EXECUTE an ALTER TABLE for each partition but would create the partition specification and modify the partition boundaries for each iteration through the loop. Sort of like
    for i from 1 to 365 loop
        add partition spec for startDate + i
    end loop;The number of iterations would be a parameter and you would start with 2 or 3. Always test with the smallest code that will produce the correct results. If the code works for 3 days it will work for any larger reasonable number.
    Then you would save that script in your version control system and run it to create the table. There would be nothing to monitor since there is just one script and when it is done it is done.
    That would be a proper use of dynamic sql: to produce DDL, not to execute it.
    Back to your issue. If I were your manager then based on what you posted I would expect you to already have
    1. a requirements document that stated the problem (e.g. performance, data management) that was being addressed
    2. test results that showed that your proposed solution (a table partitioned the way you posted) solves the problem
    The requirements doc would have detail about what the performance/management issues are and what impact they are having
    You also need to document what the possible solutions are, the relative merits of each solution and the factors you considered when ranking the solutions. That is, why is your particular partitioning scheme the best solution for the problem.
    You should have test results that show the execution plans and performance you achieved by using a test version of your proposed table and indexes.
    Until you have 'proven' that your solution will work as you expect I wouldn't recommend implementing the full-blown version of it.
    1. Create a table MANUALLY that has 2 or three days worth of partitions.
    2. Load those partitions with a representative amount of data
    3. Execute test queries to query data from one of those partitions
    4. Execute the same test queries against your current table
    5. Capture the execution plans (the actual ones) for those queries. Verify that you are getting the performance improvements that you expected.
    Once ALL of that prep work is done and you have concluded that your table/index design is correct then go back to work on writing a script/procedure that will produce (not execute) DDL to produce the main table and partitioning you designed.
    Just an aside on what you posted. The indexes should be created AFTER the table and its partitions are created. If you are creating your local index first, as you post suggests, you are forcing Oracle to revamp it 1800 times when each partition is added. Just create the index after the table.
    p.s. the number of posts anyone has is irrevelant. The only thing that matters is whether the advice or suggestions they provide is helpful. And the helpfullness of those is limited to, and based on, ONLY the information a poster provides. For exampe, your proposed partitioning scheme might be perfectly appropriate for your use case or it could be totally inappropriate. We have no way of knowing without knowing WHY you chose that scheme.
    But I haven't seen one like that so it makes me suspicious that you really need to get that complicated.

  • Doubt in subpartitioning of a table

    hi gems...good evening..
    I have a table which previously had only range partitions.
    Now I changed it to range-hash composite partitioning.
    There are 6 partition tablespaces namely TS_PART1, TS_PART2.....TS_PART 6.
    The default tablespace of the schema is TS_PROD.
    The table had following structure previously:
    create table ORDER_BOOK
    CUST_ID NUMBER(10),
    PROFILE_ID NUMBER(10),
    PRODUCT_ID NUMBER(10),
    SUB_PROFILE_ID VARCHAR2(25),
    CASHFLOW_DATE DATE,
    EARNINGS NUMBER(24,6),
    constraint ORDER_BOOK_PK primary key(CUST_ID,PROFILE_ID,PRODUCT_ID,SUB_PROFILE_ID,CASHFLOW_DATE)
    partition by range (CASHFLOW_DATE)
    partition ORDER_BOOK_PART1 values less than (TO_DATE('01-01-2003', 'DD-MM-YYYY')) tablespace TS_PART1,
    partition ORDER_BOOK_PART2 values less than (TO_DATE('01-01-2006', 'DD-MM-YYYY')) tablespace TS_PART2,
    partition ORDER_BOOK_PART3 values less than (TO_DATE('01-01-2009', 'DD-MM-YYYY')) tablespace TS_PART3,
    partition ORDER_BOOK_PART4 values less than (TO_DATE('01-01-2012', 'DD-MM-YYYY')) tablespace TS_PART4,
    partition ORDER_BOOK_PART5 values less than (TO_DATE('01-01-2015', 'DD-MM-YYYY')) tablespace TS_PART5,
    partition ORDER_BOOK_PART6 values less than (TO_DATE('01-01-2018', 'DD-MM-YYYY')) tablespace TS_PART6
    create index ORDER_BOOK_IDX on ORDER_BOOK(PRODUCT_ID,CASHFLOW_DATE);
    Now I did the following steps to change the previously existing partitions to the new range-hash composite partitions:
    begin
    dbms_redefinition.can_redef_table
    (uname=>'DEMO_TEST',
    tname=>'ORDER_BOOK',
    options_flag=>DBMS_REDEFINITION.CONS_USE_PK);
    end;
    create table INTERIM_ORDER_BOOK
    CUST_ID NUMBER(10),
    PROFILE_ID NUMBER(10),
    PRODUCT_ID NUMBER(10),
    SUB_PROFILE_ID VARCHAR2(25),
    CASHFLOW_DATE DATE,
    EARNINGS NUMBER(24,6),
    constraint INTERIM_ORDER_BOOK_PK primary key(CUST_ID,PROFILE_ID,PRODUCT_ID,SUB_PROFILE_ID,CASHFLOW_DATE)
    partition by range(CASHFLOW_DATE)
    subpartition by hash (CUST_ID)
    subpartition template
    subpartition SP1 tablespace TS_PART1,
    subpartition SP2 tablespace TS_PART2,
    subpartition SP3 tablespace TS_PART3,
    subpartition SP4 tablespace TS_PART4,
    subpartition SP5 tablespace TS_PART5,
    subpartition SP6 tablespace TS_PART6
    (partition P1 values less than (to_date('01-01-2003','DD-MM-YYYY')),
    partition P2 values less than (to_date('01-01-2006','DD-MM-YYYY')),
    partition P3 values less than (to_date('01-01-2009','DD-MM-YYYY')),
    partition P4 values less than (to_date('01-01-2012','DD-MM-YYYY')),
    partition P5 values less than (to_date('01-01-2015','DD-MM-YYYY')),
    partition P6 values less than (to_date('01-01-2018','DD-MM-YYYY')))
    enable row movement;
    begin
    dbms_redifinition.start_redef_table
    (uname=>'DEMO_TEST',
    orig_table=>'ORDER_BOOK',
    int_table=>'INTERIM_ORDER_BOOK',
    options_flag=>DBMS_REDEFINITION.CONS_USE_PK);
    end;
    begin
    dbms_redefinition.finish_redef_table
    (uname=>'DEMO_TEST',
    orig_table=>'ORDER_BOOK',
    int_table=>'INTERIM_ORDER_BOOK');
    end;
    After that I made the index with LOCAL clause i.e local index.
    But the problem is that...initially when there is only range partitioning, then the datas are going to the corresponding partition tablespaces.
    But after modifying the table, populating the table results in consumption of space in both partition tablespaces as well as the default tablespace.
    I have checked the size of the tablespaces. From that I came to know about this.
    The output of the USER_TAB_SUBPARTITIONS is okk...every subpartitions are in the corresponding tablespaces.
    But the main partitions (USER_TAB_PARTITION) are in the default tablespace.
    please help me....thanks in advance...
    Edited by: user12780416 on Apr 13, 2012 7:46 AM

    user12780416 wrote:
    Thanks sir for your reply...
    Yes, by MOVE syntax I can move the partitions in the corresponding tablespaces.
    But i am not getting the reason of consumption of both the tablespaces.
    The TS_PART1 increased 2MB, TS_PART2 increased 6MB, TS_PART3 increased 2MB, TS_PART4 increased 5MB, TS_PART5 increased 9MB.
    and TS_PROD increased (2+6+2+5+9)=24MB
    Why is this happening ?
    I have read that when we make subpartitions, they main partitions are the logical entity only and the subpartitions are the physical entity.Where have you read this?
    As RP rightly pointed out, you can specify a tablespace for each partition (each partition using a different tablespace) and a tablespace for each subpartitions (again, using many if you felt like it).

  • Partition exchange loading for specific subpartitions

    Hi All,
    Looking at an archive strategy - where we have to archive a specific dataset.
    Rather than a insert/delete routine - I was thinking of using partition exchange.
    The to-be archived table is interval range partitioned on date, with a list subpartition on country.
    It is for specific countries that I want to partition exchange.
        create table
        test_table
        (tbl_id number,
        country varchar2(2),
        sales_dt date,
        volume number)
        partition by range (sales_dt) interval (NUMTOYMINTERVAL(1,'Month'))
        subpartition by list (country)
        Subpartition template
        (subpartition p_ireland values ('IR'),
        subpartition p_france values ('FR'),
        subpartition p_other values (DEFAULT))
        (partition before_2008 values less than (to_date('01-JAN-2008','DD-MON-YYYY'))); The data loaded falls into the partitions and subpartitions correctly. All the partitions names are system generated.
    When I come to partition exchange for all the 'FR' subpartitions- I can't determine the logic.
    Using
        Alter table test_table
        exchange subpartition system_generated_name
        with table TEST_TABLE_ARCH;I can swap out a specific 'known' subpartition.
    I know you can use the 'for' logic with Oracle 11g but can't get the syntax to work.
    Any ideas?

    The error means you are trying to swap a partition that still contains data in a configuration where OWB expects an empty partition. How did you set the "Replace existing data in Target Partition" configuration parameter?
    Also, for more details on PEL, review the 10.19 to 10.27 pages of the user manual.
    Regards:
    Igor

  • Subpartition issue.

    Hello Folks,
    I am having 1 table, and it has 3 partitions and one of it's having max value and I want to create subpartition inside that partition. When I have created subpartition it's got created with system generated name. When I am trying to explicitly specify that name it's throwing me below error.
    alter table x_event split partition LOG_MAX
    AT(TO_DATE(' 2012-01-01 00:00:00','SYYYY-MM-DD HH24:MI:SS','NLS_CALENDAR=GREGORIAN'))
    INTO (PARTITION Y11M12 SUBPARTITIONS Y11M12_FSM VALUES('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')) UPDATE GLOBAL INDEXES ; 2 3
    INTO (PARTITION Y11M12 SUBPARTITIONS Y11M12_FSM VALUES('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')) UPDATE GLOBAL INDEXES
    ERROR at line 3:
    ORA-14156: invalid number of subpartitions specified in [SUBPARTITIONS |
    SUBPARTITION TEMPLATE] clause
    has anybody has got the same issue before ?

    HG,
    I tried using the code you posted here but it got lots of syntax errors and moreover it has subpatition by list and trying to use hash subpartitioning style. So based on your information, i created table with 3 range partitions a list partitions (see sql for more details).
    Sql for creating range/list composite partitioned table
    CREATE TABLE klondike.xlog_event (
    xlog_even_id NUMBER (38) NOT NULL,
    xlog_date DATE NOT NULL,
    xlog_id NUMBER (38) NOT NULL,
    xlog_event_type_id NUMBER (38) NOT NULL,
    xlog_event_status_id NUMBER (38) NOT NULL,
    detail_count NUMBER (38) NOT NULL,
    start_date timestamp (6) NOT NULL,
    end_date timestamp (6) NOT NULL
    TABLESPACE xlog_event_data
    LOGGING
    PARTITION BY RANGE (xlog_date)
    SUBPARTITION BY LIST (xlog_event_type_id)
    *(PARTITION y09m12*
    VALUES LESS THAN
    *( (TO_DATE ('2010-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')))*
    LOGGING
    NOCOMPRESS
    TABLESPACE xlog_event_data
    *(SUBPARTITION sub_y09m12 VALUES (200) TABLESPACE xlog_event_data),*
    PARTITION y10m12
    VALUES LESS THAN
    *( (TO_DATE ('2011-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')))*
    LOGGING
    NOCOMPRESS
    TABLESPACE xlog_event_data
    *(SUBPARTITION sub_y10m12 VALUES (300) TABLESPACE xlog_event_data),*
    PARTITION xlog_max
    VALUES LESS THAN (maxvalue)
    LOGGING
    NOCOMPRESS
    TABLESPACE xlog_event_data
    SUBPARTITION y06_fsm
    VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_fsd
    VALUES (50, 51, 52, 53, 54, 55, 56, 57, 58, 59)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_mis
    VALUES (40, 41, 42, 43, 44, 45, 46, 47, 48, 49)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_imp
    VALUES (20, 21, 22, 23, 24, 25, 26, 27, 28, 29)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_omp
    VALUES (30, 31, 32, 33, 34, 35, 36, 37, 38, 39)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_iep
    VALUES (60, 61, 62, 63, 64, 65, 66, 67, 68, 69)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_oep
    VALUES (70, 71, 72, 73, 74, 75, 76, 77, 78, 79)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_emd
    VALUES (80, 81, 82, 83, 84, 85, 86, 87, 88, 89)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_man
    VALUES (100, 101, 102, 103, 104, 105, 106, 107, 108, 109)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_evt
    VALUES (110, 111, 112, 113, 114, 115, 116, 117, 118, 119)
    TABLESPACE xlog_event_data,
    SUBPARTITION y06_msa
    VALUES (90, 91, 92, 93, 94, 95, 96, 97, 98, 99)
    TABLESPACE xlog_event_data
    Later I split LOG_MAX patition and split subpatition Y06_FSM into Y11M12_FSM , see below for synatx.
    ALTER TABLE XLOG_EVENT
    SPLIT SUBPARTITION Y06_FSM
    VALUES (0,1,2,3,4)
    INTO (SUBPARTITION Y11M12_FSM  TABLESPACE XLOG_EVENT_DATA
    *, SUBPARTITION Y06_FSM)*
    UPDATE GLOBAL INDEXES;
    ALTER TABLE xlog_event
    SPLIT PARTITION xlog_max AT
    *((TO_DATE('2012-01-01 00:00:00','YYYY-MM-DD HH24:MI:SS')))*
    INTO (PARTITION y11m12
    TABLESPACE xlog_event_data
    *, PARTITION xlog_max);*
    Once you are done later you can rename system generated subpartition name with your choice of name using following
    E.g.
    ALTER TABLE XLOG_EVENT   RENAME SUBPARTITION SYS_SUBP143  TO Y11M12_1;
    Let me know if this helps you out and answer your question.
    Regards

  • Required alter script for adding partition and subpartition

    Hi Folks,
    Please help me to write ALTER STATEMENT for adding new partition P1 and SUBPARTITION P1_201001 and P1_201002.
    Thank you
    TABLE
    =======
    CREATE TABLE TEST
         "REPORT_ID"    NUMBER,
        "MONTH_ID"      NUMBER,
        "GROUP_ID"      NUMBER,
        "AGE_GROUP_ID"  NUMBER,
        "GENDER_CD"     CHAR(1 BYTE),
    PCTFREE 0 PCTUSED 0 INITRANS 1 MAXTRANS 255 COMPRESS BASIC NOLOGGING STORAGE
        BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
      TABLESPACE "USER_WORK" PARTITION BY RANGE
        "REPORT_ID"
      SUBPARTITION BY LIST
        "MONTH_ID"
      SUBPARTITION TEMPLATE
        SUBPARTITION "M201212" VALUES
          201212
        TABLESPACE "USER_WORK"
    (PARTITION "P3" VALUES LESS THAN (4) PCTFREE 0 PCTUSED 0 INITRANS 1 MAXTRANS 255 STORAGE( BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "USER_WORK" COMPRESS BASIC NOLOGGING ( SUBPARTITION "P3_M201212" VALUES
          201212
        TABLESPACE "USER_WORK" COMPRESS BASIC, SUBPARTITION "P3_M201301" VALUES
          201301
        TABLESPACE "USER_WORK" COMPRESS BASIC )
    );

    First modify the subpartition template
    ALTER TABLE TEST set
      SUBPARTITION TEMPLATE
        SUBPARTITION "M201212" VALUES
          201212
        SUBPARTITION P1_201001 VALUES (201001),
        SUBPARTITION P1_201002 VALUES (201002)
      )Then if the new partition is HIGHER than ALL existing ranges you can just add it
    alter table test add
    PARTITION "P1" VALUES LESS THAN (5) If the new partition is LOWER than one onf the existing ranges you will need to SPLIT the existing partition.
    alter table test SPLIT PARTITION "P3" AT (2)
    INTO (PARTITION P1, PARTITION P3)See the sections in the VLDB and Partitioning Guide
    Modifying a Subpartition Template
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007904
    Splitting a Partition of a Range-Partitioned Table
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1008028

  • Subpartition by range?

    Hello,
    I created the following partitioned table, using Oracle 11g R2 interval partitioning:
    CREATE TABLE ACCOUNTS_IMPORT (
    SIGNING_ACCOUNT VARCHAR2(16 CHAR),
    REPORT_MM DATE,
    IMPORT_ID INTEGER -- this is a unique number incremented by 1 (1, 2, 3,....etc)
    PARTITION BY RANGE (REPORT_MM)
    INTERVAL( NUMTOYMINTERVAL(1,'MONTH'))
    (PARTITION p_first VALUES LESS THAN ('01-JAN-2006'));
    Works correctly; every time I insert data for a new month, Oracle automatically creates a new partition.
    For example: for the month of July I add 3 batches of records identified by IMPORT_ID 11, 12 and 13 and they all go into the same partition. This is exactly what I want.
    But I also want that any record batch identified by the unique IMPORT_ID to go into a new subpartition. How can I achieve that?
    Because IMPORT_ID keeps incrementing I cannot create from the beginning the subpartitions using something like:
    PARTITION BY RANGE (REPORT_MM) INTERVAL( NUMTOYMINTERVAL(1,'MONTH'))
    SUBPARTITION BY RANGE(IMPORT_ID)
    SUBPARTITION TEMPLATE(
    SUBPARTITION sp_11 VALUES(11),
    SUBPARTITION sp_12 VALUES(12) ,
    SUBPARTITION sp_13 VALUES(13))
    Would be possible to add subpartitions on the fly or maybe get Oracle to create them automatically?
    Thanks,
    M.R.

    user7047382 wrote:
    Hello,
    I created the following partitioned table, using Oracle 11g R2 interval partitioning:
    CREATE TABLE ACCOUNTS_IMPORT (
    SIGNING_ACCOUNT VARCHAR2(16 CHAR),
    REPORT_MM DATE,
    IMPORT_ID INTEGER -- this is a unique number incremented by 1 (1, 2, 3,....etc)
    PARTITION BY RANGE (REPORT_MM)
    INTERVAL( NUMTOYMINTERVAL(1,'MONTH'))
    (PARTITION p_first VALUES LESS THAN ('01-JAN-2006'));
    Works correctly; every time I insert data for a new month, Oracle automatically creates a new partition.
    For example: for the month of July I add 3 batches of records identified by IMPORT_ID 11, 12 and 13 and they all go into the same partition. This is exactly what I want.
    But I also want that any record batch identified by the unique IMPORT_ID to go into a new subpartition. How can I achieve that?
    Because IMPORT_ID keeps incrementing I cannot create from the beginning the subpartitions using something like:
    PARTITION BY RANGE (REPORT_MM) INTERVAL( NUMTOYMINTERVAL(1,'MONTH'))
    SUBPARTITION BY RANGE(IMPORT_ID)
    SUBPARTITION TEMPLATE(
    SUBPARTITION sp_11 VALUES(11),
    SUBPARTITION sp_12 VALUES(12) ,
    SUBPARTITION sp_13 VALUES(13))
    Would be possible to add subpartitions on the fly or maybe get Oracle to create them automatically?NO!

  • Range - Interval Partition and List Subpartition.

    Hi
    I am trying to create the Range(Interval) Partition with List Sub partition (dynamically). Here the LOCATION_CD List is Dynamic. Basically Location_CD is Country name. e.g USA, IND,GER.....
    Below Works good...
    CREATE TABLE TEMP
    SEQUENCE_ID NUMBER,
    RESERVATION_DATE TIMESTAMP,
    LOCATION_CD VARCHAR2(5)
    PARTITION BY RANGE (RESERVATION_DATE)
    INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
    SUBPARTITION BY LIST(LOCATION_CD)
    SUBPARTITION TEMPLATE
    ( SUBPARTITION CD_01 VALUES ('USA'),
    SUBPARTITION CD_02 VALUES ('IND'),
    SUBPARTITION CD_03 VALUES ('GER')
    PARTITION TEMP values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY'))
    Today there are 3 Countries but going forward it can be more or less.
    I like the Interval Range Partition concept, where the new partition is automatically gets added.
    But at the same time can the new list sub partition be added ? If this doesn't work...can we have another alternative approach or partition technique ?
    Please suggest.
    Thanks
    Jitesh R.

    Why didn't you just perform two inserts and answer the question yourself?
    orabase> CREATE TABLE T (
      2  SEQUENCE_ID      NUMBER,
      3  RESERVATION_DATE TIMESTAMP,
      4  LOCATION_CD      VARCHAR2(5))
      5  PARTITION BY RANGE (RESERVATION_DATE)
      6  INTERVAL (NUMTOYMINTERVAL(1,'MONTH'))
      7  SUBPARTITION BY LIST(LOCATION_CD)
      8  SUBPARTITION TEMPLATE (
      9  SUBPARTITION CD_01 VALUES ('USA'),
    10  SUBPARTITION CD_02 VALUES ('IND'),
    11  SUBPARTITION CD_03 VALUES ('GER')) (
    12  PARTITION root values LESS THAN (TO_DATE('01-JAN-2000','DD-MON-YYYY')));
    Table created.
    orabase> insert into t values (1, TO_DATE('02-JAN-2000'), 'USA');
    1 row created.
    orabase> select partition_name, subpartition_name
      2  from user_tab_subpartitions
      3  where table_name = 'T';
    PARTITION_NAME                 SUBPARTITION_NAME
    ROOT                           ROOT_CD_03
    ROOT                           ROOT_CD_02
    ROOT                           ROOT_CD_01
    SYS_P84                        SYS_SUBP83
    SYS_P84                        SYS_SUBP82
    SYS_P84                        SYS_SUBP81
    6 rows selected.
    orabase>  insert into t values (1, TO_DATE('02-JAN-2000')+400, 'USA');
    1 row created.
    orabase> select partition_name, subpartition_name
      2  from user_tab_subpartitions
      3  where table_name = 'T';
    PARTITION_NAME                 SUBPARTITION_NAME
    SYS_P88                        SYS_SUBP85
    SYS_P88                        SYS_SUBP86
    SYS_P88                        SYS_SUBP87
    SYS_P84                        SYS_SUBP81
    SYS_P84                        SYS_SUBP82
    SYS_P84                        SYS_SUBP83
    ROOT                           ROOT_CD_01
    ROOT                           ROOT_CD_02
    ROOT                           ROOT_CD_03
    9 rows selected.

  • Using PARTITION FOR/SUBPARTITION FOR syntax to insert

    We are trying to use PARTITION FOR syntax (or, better, SUBPARTITION FOR syntax) to insert into a subpartitioned table.
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/sql_elements009.htm#i165979
    08:26:46 GM_CS_CDR@oradev02> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    5 rows selected.This table is has interval partitions on DATA_ORIGIN_ID and list subpartitions on TABLE_NAME.
    First, a basic insert without specifying partitions:
    08:10:05 GM_CS_CDR@oradev02> insert into key_ids2 (
    08:11:51   2  DATA_ORIGIN_ID         ,
    08:11:51   3  TABLE_NAME             ,
    08:11:51   4  DUR_UK                 ,
    08:11:51   5  DUR_UK_ID              )
    08:11:51   6  select
    08:11:51   7  12         ,
    08:11:51   8  TABLE_NAME             ,
    08:11:51   9  DUR_UK                 ,
    08:11:51  10  DUR_UK_ID             
    08:11:51  11  from key_ids where table_name = 'PART'
    08:11:51  12  and rownum <= 10;
    10 rows created.Verifying SUBPARTITION FOR syntax on a SELECT:
    08:19:43 GM_CS_CDR@oradev02>
    08:26:45 GM_CS_CDR@oradev02>
    08:26:45 GM_CS_CDR@oradev02>
    08:26:45 GM_CS_CDR@oradev02>
    08:26:45 GM_CS_CDR@oradev02> select count(*) from key_ids2
    08:26:45   2  subpartition for(12,'PART');
      COUNT(*)
            10
    1 row selected.But when we add a subpartition specification (to limit the lock to a single subpartition), we get a syntax error:
    08:14:57 GM_CS_CDR@oradev02> insert into key_ids2 subpartition for(12,'PART') (
    08:14:57   2  DATA_ORIGIN_ID         ,
    08:14:57   3  TABLE_NAME             ,
    08:14:57   4  DUR_UK                 ,
    08:14:57   5  DUR_UK_ID              )
    08:14:57   6  select
    08:14:57   7  14         ,
    08:14:57   8  TABLE_NAME             ,
    08:14:57   9  DUR_UK||'!'                 ,
    08:14:57  10  DUR_UK_ID             
    08:14:57  11  from key_ids
    08:14:57  12  where table_name = 'PART'
    08:14:57  13  and rownum <= 10;
    insert into key_ids2 subpartition for(12,'PART') (
    ERROR at line 1:
    ORA-14173: illegal subpartition-extended table name syntaxSpecifying at the partition level did not work either:
    08:14:58 GM_CS_CDR@oradev02> insert into key_ids2 partition for(14) (
    08:15:23   2  DATA_ORIGIN_ID         ,
    08:15:23   3  TABLE_NAME             ,
    08:15:23   4  DUR_UK                 ,
    08:15:23   5  DUR_UK_ID              )
    08:15:23   6  select
    08:15:23   7  14         ,
    08:15:23   8  TABLE_NAME             ,
    08:15:23   9  DUR_UK||'!'                 ,
    08:15:23  10  DUR_UK_ID             
    08:15:23  11  from key_ids
    08:15:23  12  where table_name = 'PART'
    08:15:23  13  and rownum <= 10;
    insert into key_ids2 partition for(14) (
    ERROR at line 1:
    ORA-14108: illegal partition-extended table name syntaxBut specifying explicit partition and subpartition does work:
    08:17:45 GM_CS_CDR@oradev02> insert into key_ids2 partition (SYS_P15127) (
    08:18:23   2  DATA_ORIGIN_ID         ,
    08:18:23   3  TABLE_NAME             ,
    08:18:23   4  DUR_UK                 ,
    08:18:23   5  DUR_UK_ID              )
    08:18:23   6  select
    08:18:23   7  12         ,
    08:18:23   8  TABLE_NAME             ,
    08:18:23   9  DUR_UK||'!'                 ,
    08:18:23  10  DUR_UK_ID             
    08:18:23  11  from key_ids
    08:18:23  12  where table_name = 'PART'
    08:18:23  13  and rownum <= 10;
    10 rows created.
    08:18:24 GM_CS_CDR@oradev02> insert into key_ids2 subpartition (SYS_SUBP15126) (
    08:19:42   2  DATA_ORIGIN_ID         ,
    08:19:42   3  TABLE_NAME             ,
    08:19:42   4  DUR_UK                 ,
    08:19:42   5  DUR_UK_ID              )
    08:19:42   6  select
    08:19:42   7  12         ,
    08:19:42   8  TABLE_NAME             ,
    08:19:42   9  DUR_UK||'!#'                 ,
    08:19:42  10  DUR_UK_ID             
    08:19:42  11  from key_ids
    08:19:42  12  where table_name = 'PART'
    08:19:42  13  and rownum <= 10;
    10 rows created.We have been successful in using the PARTITION FOR syntax for tables that were partitioned but not subpartitioned.
    Any ideas?
    Thanks,
    Mike

    I've created a simplified script to reproduce our issue. The use of the syntax on an INSERT INTO using VALUES still produces the same error.
    Thanks,
    Andy
    select * from v$version;
    create table part_test_tbl
      data_origin_id NUMBER  not null,
      table_name VARCHAR2(30) not null,
      dur_uk     VARCHAR2(250) not null,
      dur_uk_id  NUMBER
    partition by range (data_origin_id) INTERVAL (1)
    subpartition by list (TABLE_NAME)
    SUBPARTITION TEMPLATE(
      subpartition BLUE values ('BLUE'),
      subpartition RED values ('RED'),
      subpartition YELLOW values ('YELLOW'),
      subpartition GREEN values ('GREEN'),
      subpartition ORANGE values ('ORANGE')
    (PARTITION DFLT_INTRVL VALUES LESS THAN (0)
      subpartition BLUE values ('BLUE'),
      subpartition RED values ('RED'),
      subpartition YELLOW values ('YELLOW'),
      subpartition GREEN values ('GREEN'),
      subpartition ORANGE values ('ORANGE')
    -- Create/Recreate indexes
    create index PART_TEST_TBL_PK on PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
      compress 2  local;
    create unique index PART_TEST_TBL_UK on PART_TEST_TBL (TABLE_NAME, DUR_UK_ID)
      compress 1;
    -- Create/Recreate primary, unique and foreign key constraints
    alter table PART_TEST_TBL
      add constraint PART_TEST_TBL_PK primary key (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK) USING INDEX PART_TEST_TBL_PK;
    alter table PART_TEST_TBL
      add constraint PART_TEST_TBL_UK unique (TABLE_NAME, DUR_UK_ID) USING INDEX PART_TEST_TBL_UK;
    --Add test data
    BEGIN
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (0, 'BLUE', '1', 1);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (0, 'BLUE', '2', 2);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (0, 'YELLOW', '3', 3);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (0, 'GREEN', '4', 4);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (0, 'ORANGE', '5', 5);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (1, 'BLUE', '6', 6);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (1, 'BLUE', '7', 7);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (1, 'YELLOW', '8', 8);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (1, 'GREEN', '9', 9);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (1, 'ORANGE', '10', 10);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (2, 'BLUE', '11', 11);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (2, 'BLUE', '12', 12);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (2, 'YELLOW', '13', 13);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (2, 'GREEN', '14', 14);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (2, 'ORANGE', '15', 15);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (10, 'BLUE', '16', 16);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (10, 'BLUE', '17', 17);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (10, 'YELLOW', '18', 18);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (10, 'GREEN', '19', 19);
       insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
       values (10, 'ORANGE', '20', 20);
       COMMIT;
    END;
    --Validate the subpartition_extended syntax
    select count(*) from PART_TEST_TBL subpartition for(10,'BLUE');
    --Show subpartition_extended syntax does not work on INSERT INTO
    INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
    (data_origin_id
    ,table_name
    ,dur_uk
    ,dur_uk_id)
    VALUES
    (10
    ,'BLUE'
    ,'16!'
    ,1016);
    --Show subpartition_extended syntax does not work on INSERT INTO
    INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
    (data_origin_id
    ,table_name
    ,dur_uk
    ,dur_uk_id)
    SELECT ptt.data_origin_id
          ,ptt.table_name
          ,ptt.dur_uk || '!' dur_uk
          ,ptt.dur_uk_id + 1000 dur_uk_id
      FROM PART_TEST_TBL ptt
    WHERE ptt.table_name = 'BLUE'
       AND ptt.data_origin_id = 10;
    DROP TABLE part_test_tbl PURGE;-----
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE  11.2.0.3.0  Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    SQL> create table part_test_tbl
      2  (
      3    data_origin_id NUMBER  not null,
      4    table_name VARCHAR2(30) not null,
      5    dur_uk     VARCHAR2(250) not null,
      6    dur_uk_id  NUMBER
      7  )
      8  partition by range (data_origin_id) INTERVAL (1)
      9  subpartition by list (TABLE_NAME)
    10  SUBPARTITION TEMPLATE(
    11    subpartition BLUE values ('BLUE'),
    12    subpartition RED values ('RED'),
    13    subpartition YELLOW values ('YELLOW'),
    14    subpartition GREEN values ('GREEN'),
    15    subpartition ORANGE values ('ORANGE')
    16  )
    17  (PARTITION DFLT_INTRVL VALUES LESS THAN (0)
    18    (
    19    subpartition BLUE values ('BLUE'),
    20    subpartition RED values ('RED'),
    21    subpartition YELLOW values ('YELLOW'),
    22    subpartition GREEN values ('GREEN'),
    23    subpartition ORANGE values ('ORANGE')
    24    )
    25  );
    Table created
    SQL> -- Create/Recreate indexes
    SQL> create index PART_TEST_TBL_PK on PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
      2    compress 2  local;
    Index created
    SQL> create unique index PART_TEST_TBL_UK on PART_TEST_TBL (TABLE_NAME, DUR_UK_ID)
      2    compress 1;
    Index created
    SQL> -- Create/Recreate primary, unique and foreign key constraints
    SQL> alter table PART_TEST_TBL
      2    add constraint PART_TEST_TBL_PK primary key (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK) USING INDEX PART_TEST_TBL_PK;
    Table altered
    SQL> alter table PART_TEST_TBL
      2    add constraint PART_TEST_TBL_UK unique (TABLE_NAME, DUR_UK_ID) USING INDEX PART_TEST_TBL_UK;
    Table altered
    SQL> --Add test data
    SQL> BEGIN
      2 
      3     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
      4     values (0, 'BLUE', '1', 1);
      5 
      6     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
      7     values (0, 'BLUE', '2', 2);
      8 
      9     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    10     values (0, 'YELLOW', '3', 3);
    11 
    12     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    13     values (0, 'GREEN', '4', 4);
    14 
    15     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    16     values (0, 'ORANGE', '5', 5);
    17 
    18     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    19     values (1, 'BLUE', '6', 6);
    20 
    21     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    22     values (1, 'BLUE', '7', 7);
    23 
    24     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    25     values (1, 'YELLOW', '8', 8);
    26 
    27     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    28     values (1, 'GREEN', '9', 9);
    29 
    30     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    31     values (1, 'ORANGE', '10', 10);
    32 
    33     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    34     values (2, 'BLUE', '11', 11);
    35 
    36     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    37     values (2, 'BLUE', '12', 12);
    38 
    39     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    40     values (2, 'YELLOW', '13', 13);
    41 
    42     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    43     values (2, 'GREEN', '14', 14);
    44 
    45     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    46     values (2, 'ORANGE', '15', 15);
    47 
    48     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    49     values (10, 'BLUE', '16', 16);
    50 
    51     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    52     values (10, 'BLUE', '17', 17);
    53 
    54     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    55     values (10, 'YELLOW', '18', 18);
    56 
    57     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    58     values (10, 'GREEN', '19', 19);
    59 
    60     insert into PART_TEST_TBL (DATA_ORIGIN_ID, TABLE_NAME, DUR_UK, DUR_UK_ID)
    61     values (10, 'ORANGE', '20', 20);
    62 
    63     COMMIT;
    64  END;
    65  /
    PL/SQL procedure successfully completed
    SQL> --Validate the subpartition_extended syntax
    SQL> select count(*) from PART_TEST_TBL subpartition for(10,'BLUE');
      COUNT(*)
             2
    SQL> --Show subpartition_extended syntax does not work on INSERT INTO
    SQL> INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
      2  (data_origin_id
      3  ,table_name
      4  ,dur_uk
      5  ,dur_uk_id)
      6  VALUES
      7  (10
      8  ,'BLUE'
      9  ,'16!'
    10  ,1016);
    INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
    (data_origin_id
    ,table_name
    ,dur_uk
    ,dur_uk_id)
    VALUES
    (10
    ,'BLUE'
    ,'16!'
    ,1016)
    ORA-14173: illegal subpartition-extended table name syntax
    SQL> --Show subpartition_extended syntax does not work on INSERT INTO
    SQL> INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
      2  (data_origin_id
      3  ,table_name
      4  ,dur_uk
      5  ,dur_uk_id)
      6  SELECT ptt.data_origin_id
      7        ,ptt.table_name
      8        ,ptt.dur_uk || '!' dur_uk
      9        ,ptt.dur_uk_id + 1000 dur_uk_id
    10    FROM PART_TEST_TBL ptt
    11   WHERE ptt.table_name = 'BLUE'
    12     AND ptt.data_origin_id = 10;
    INSERT /*+APPEND */ INTO PART_TEST_TBL SUBPARTITION FOR (10,'BLUE')
    (data_origin_id
    ,table_name
    ,dur_uk
    ,dur_uk_id)
    SELECT ptt.data_origin_id
          ,ptt.table_name
          ,ptt.dur_uk || '!' dur_uk
          ,ptt.dur_uk_id + 1000 dur_uk_id
      FROM PART_TEST_TBL ptt
    WHERE ptt.table_name = 'BLUE'
       AND ptt.data_origin_id = 10
    ORA-14173: illegal subpartition-extended table name syntax
    SQL> DROP TABLE part_test_tbl PURGE;
    Table dropped
    SQL>

Maybe you are looking for

  • How do I set up a mixer with a reverb bus and send to it?

    I'm just starting with STP so forgive me if this is a stupid question, okay? I'm using Soundtrack Pro exclusively for multitrack audio. I will typically have 8 audio tracks I import into STP, each of which has its own channel strip in the mixer. I ha

  • Installation was interrupted message for a routine upgrade

    Right after "Publishing product information": "The iTunes for Windows installer has completed. The installation was interrupted before iTunes could be completely installed. The System has not been modified. To install this program at a later time, ru

  • Can't open PSE 7

    I can't open photoshop elements, I keep getting the following error messages: Adobe Photoshop Elements(Editor) has stop working And then it says: A problem caused the program to stop working correctly. Windows will close the program and notify you if

  • Tecra M5 PTM51L: I did not find any updates on Tosh site

    My computer has the model number written at basement as; Tecra M5 Model no. PTM51L 0JG010. I dont find any updates of softwares from the toshiba site. All the updates are for PMM51U-xxxxx and nothing for above mentioned model. I dont understand this

  • Forms Prouct Management - Free online seminar

    I will be presenting an online seminar on Forms future and modernization strategies on the 22nd October 2009. Details of the event and registration are linked from the [Forms home page|http://otn.oracle.com/products/forms]