当前位置: 代码迷 >> Oracle开发 >> Oracle创设表分区
  详细解决方案

Oracle创设表分区

热度:91   发布时间:2016-04-24 06:36:51.0
Oracle创建表分区
create table T1 as select * from scott.emp
partition by list (deptno)(
partition p1 values less than (10),
partition p2 values less than (20),
partition p3 values less than (30),
partition p4 values less than (40)
)


创建表分区时提示缺失左括号
------解决方案--------------------
语法有问题
LIST  分区--> VALUES (10) 
RANGE分区-->values less than (10)
------解决方案--------------------
格式错误,原因

1、同上
2、分区语句 应该 as 语句之前



create table T1
partition by range (deptno)(
partition p1 values less than (10),
partition p2 values less than (20),
partition p3 values less than (30),
partition p4 values less than (40)
)
as select * from scott.emp



create table T1 
partition by list (deptno)(
partition p1 values(10),
partition p2 values(20),
partition p3 values(30),
partition p4 values(40) 
 

 as select * from scott.emp


见官方说明 
 If the selected table is partitioned, then you can choose whether the new table will be partitioned the same way,
 partitioned differently, or not partitioned. Partitioning is not carried over to the new table. Specify any desired
 partitioning as part of the  CREATE TABLE  statement before the  AS subquery  clause.

------解决方案--------------------
你是要建列表分区还是区域分区呢??
外面用list,里面用less than?

--]用list分区
create table scott.test01 
partition by list (deptno)(
partition p1 values  (10),
partition p2 values  (20),
partition p3 values  (30),
partition p4 values (40)
)
as select * from scott.emp
--用range分区
create table scott.test02
partition by range (deptno)(
partition p1 values less than (10),
partition p2 values less than(20),
partition p3 values less than(30),
partition p4 values less than(40)
)
as select * from scott.emp

------解决方案--------------------
引用:
格式错误,原因

1、同上
2、分区语句 应该 as 语句之前



create table T1
partition by range (deptno)(
partition p1 values less than (10),
partition p2 values less than (20),
partition p3 values less than (30),
partition p4 values less than (40)
)
as select * from scott.emp



create table T1 
partition by list (deptno)(
partition p1 values(10),
partition p2 values(20),
partition p3 values(30),
partition p4 values(40) 
 

 as select * from scott.emp


见官方说明 
 If the selected table is partitioned, then you can choose whether the new table will be partitioned the same way,
 partitioned differently, or not partitioned. Partitioning is not carried over to the new table. Specify any desired
 partitioning as part of the  CREATE TABLE  statement before the  AS subquery  clause.


试验了这种方法可用。 
  相关解决方案