分区表中的maxvalue参数设置

结论:partition p3 values less than (maxvalue)   分区表中maxvalue如果用具体参数来代替,则整个表中可插入的最大值不能超过指定的参数。
如指定参数是15,则插入的值只能是小于15.
partition p1 values less than (5)  这里的参数5,意味着插入此分区的数值要小于5,不能大于等于。

实验1:使用maxvalue


SQL> create table test1(ab number) partition by range(ab) (partition p1 values less than (5) tablespace users,partition p2 values less than (10) tablespace users2,partition p3 values less than (maxvalue) tablespace users3);
 
Table created
SQL> insert into test1 select rownum from dual connect by rownum<13;
 
12 rows inserted


实验二:使用指定参数,插入数据验证整个表中可插入的最大值不能超过指定的参数的结论。


SQL> create table test5(ab number) partition by range(ab) (partition p1 values less than (4) tablespace users,partition p2 values less than (8) tablespace users2,partition p3 values less than (15) tablespace users3);
Table created
SQL> select * from test5;
        AB
----------
 
SQL> select * from test5 partition(p1);
        AB
----------
 
SQL> insert into test5 select rownum from dual connect by rownum<17;
insert into test5 select rownum from dual connect by rownum<17
ORA-14400: inserted partition key does not map to any partition
 
SQL> insert into test5 select rownum from dual connect by rownum<16;
insert into test5 select rownum from dual connect by rownum<16
ORA-14400: inserted partition key does not map to any partition
 
SQL> insert into test5 select rownum from dual connect by rownum<15;
14 rows inserted
SQL> commit;
Commit complete
 
SQL> select * from test5 partition(p1);
        AB
----------
         1
         2
         3
SQL> select * from test5 partition(p2);
        AB
----------
         4
         5
         6
         7
SQL> select * from test5 partition(p3);
        AB
----------
         8
         9
        10
        11
        12
        13
        14 
SQL> select * from test5 ;
        AB
----------
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10
        11
        12
        13
        14
14 rows selected
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值