You are on page 1of 1

create table product(prodno varchar(10),pname varchar (20),rate number,qty_avail

able number)
partition by list(prodno)
(
partition pd1 values('p001','p002','p003','p004'),
partition pd2 values('b001','b002','b003','b004'),
partition pd3 values('c001','c002','c003','c004'),
partition pd4 values('d001','d002','d003','d004')
)
Insert
Insert
Insert
Insert
Insert

into
into
into
into
into

product
product
product
product
product

values('p001','Puma',100,10);
values('b001','Bottle',200,20);
values('c001','Cap',200,20);
values('d001','Dustbin',250,20);
values('b002','Bat',2000,20);

select * from product;


alter table product add partition pd5
values('f001','f002','f003','f004')
select * from user_tab_partitions where table_name='PRODUCT'
alter table product rename partition pd5 to pd6
select * from user_tab_partitions where table_name='PRODUCT'
alter table product modify partition pd6 add values('f005')
select * from user_tab_partitions where table_name='PRODUCT'
alter table product modify partition pd6 drop values('f005')
select * from user_tab_partitions where table_name='PRODUCT'
alter table product merge partitions pd3,pd6 into partition pd8
select * from user_tab_partitions where table_name='PRODUCT'
select * from product partition(pd8)

You might also like