当前位置:操作系统 > Unix/Linux >>

分区表中的maxvalue参数设置

分区表中的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

 


CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,