1

I believe adding sub-partition in Oracle 11g is easy

ALTER TABLE PART_TEST
modify partition OCT19
add subpartition OCT19AXCS
values ('AXCS');

I have close to 250 partitions..namely

jan07
feb07
...
up till
...
dec26

Does it mean I need to include that many alter table statements to alter all my partitions and add sub-partitions ?

asked Mar 23, 2016 at 6:05
2
  • @JSapkota I used sub-partition template at the time of initial table creation. So I guess I need to alter the complete template with newly added sub-partition..hmm No direct way to simply add only that sub-partition...OK Commented Mar 23, 2016 at 8:55
  • 1
    @JSapkota That does not affect existing partitions. Commented Mar 23, 2016 at 9:49

1 Answer 1

3

You can just easily loop through the partitions in a PL/SQL loop, and add the subpartitions:

begin
 for p in (select partition_name from user_tab_partitions where table_name = 'PART_TEST')
 loop
 execute immediate 'alter table part_test modify partition ' || p.partition_name || ' add subpartition ' || p.partition_name || 'AXCS values (''AXCS'')'; 
 end loop;
end;
/
answered Mar 23, 2016 at 9:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.