就按范围分区好了
只要稍微变换一下思路即可
比如,为下面的3组月份,分别设立一个范围ID,也就是在表里加一个字段
partition_id,其中1表示1,4,7,10月份,2表示2,5,8,11,3表示3,6,9,12
能明白我的意思吗?
1,4,7,10
2,5,8,11
3,6,9,12create table test
(
id number(10) primary key,
partition_id number(5),
month date
)
partition by range (partition_id)
(
partition data_blastn1 values less than(2) tablespace tablespace1,
partition data_blastn6 values less than(3) tablespace tablespace2,
partition data_blastn7 values less than(4) tablespace tablespace3
)
/
只要稍微变换一下思路即可
比如,为下面的3组月份,分别设立一个范围ID,也就是在表里加一个字段
partition_id,其中1表示1,4,7,10月份,2表示2,5,8,11,3表示3,6,9,12
能明白我的意思吗?
1,4,7,10
2,5,8,11
3,6,9,12create table test
(
id number(10) primary key,
partition_id number(5),
month date
)
partition by range (partition_id)
(
partition data_blastn1 values less than(2) tablespace tablespace1,
partition data_blastn6 values less than(3) tablespace tablespace2,
partition data_blastn7 values less than(4) tablespace tablespace3
)
/
解决方案 »
- 如何监视所有发到oracle的sql语句。
- oracle 的字符串的运算问题
- 为什么PLSQL中修改表结构报ORA-25150错(不允许对区参数执行),而用sql语句却可以?
- UTL_FILE
- 如何清理数据库中的错误session 问题
- 关于pl/sql的一个查询问题
- 在一个10000万条记录的表里面有的number型字段,对这个字段索引,如何查询更快呢?
- 数据恢复千分求救!!!入者有分!!
- 计算oracle表中字段的列数???
- 求一存储过程
- 高分请较有关程序连接oracle 的问题?
- 新手提问:“decode(acd.fact_cate,'H','891200','891210') as code01”中的列别名和数据库中的字段名的关系是什么?
你在新表加一个字段总可以吧?然后把下面的脚本,写一个小程序,该一改不就得了。。
insert into new_table values(1,1月);
insert into new_table values(2,2月);
insert into new_table values(3,3月);
insert into new_table values(4,4月);
insert into new_table values(5,5月);
insert into new_table values(6,6月);或许是这样得结构?用SQLLDR导入?
1 分隔符 1月
2 分隔符 2月
3 分隔符 3月不明白,
create table test
(
id number(10) primary key,
month varchar2(2)
)
partition by list (month)
(
partition month_group1 values ('1','4','7','10'),
partition month_group2 values ('2','5','8','11'),
partition month_group3 values ('3','6','9','12')
)
Create index test_index on test(month)
local
(
partition month_group1,
partition month_group2,
partition month_group3
)
/
create table test
(
id number(10) primary key,
month date
)
partition by list (to_char(month,'MM'))
(
partition month_group1 values ('01','04','07','10'),
partition month_group2 values ('02','05','08','11'),
partition month_group3 values ('03','06','09','12')
)
我测试了,
只有这样是可以的,你自己再测试测试,我也没有用过date型的LIST,索引一定不要忘了
晚安
create table test
(
id number(10) primary key,
month varchar2(2)
)
partition by list (month)
(
partition month_group1 values ('1','4','7','10'),
partition month_group2 values ('2','5','8','11'),
partition month_group3 values ('3','6','9','12')
)
所以还是没有解决问题,月份的字段是CHAR(2),格式为‘MM’,怎么办啊?