oracle 如何在分区中未定义的分区表中插入数据?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1824341/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:33:23  来源:igfitidea点击:

How to insert data in partition table which is not defined in partition?

oraclepartitioning

提问by P Sharma

Anybody can tell me how can we insert data in partitioned table which is not satisfying partitioning condition.

任何人都可以告诉我如何在不满足分区条件的分区表中插入数据。

回答by Vincent Malgrat

you will get a ORA-14400 error:

你会得到一个 ORA-14400 错误:

SQL> CREATE TABLE t (ID NUMBER)
  2  PARTITION BY RANGE (ID)
  3  (  PARTITION t1 VALUES LESS THAN (100),
  4     PARTITION t2 VALUES LESS THAN (200)
  5  );

Table created

SQL> insert into t values (1);

1 row inserted

SQL> insert into t values (201);

insert into t values (201)
            ~
ORA-14400: inserted partition key does not map to any partition

To avoid this, you could use a default partition with LESS THAN (MAXVALUE):

为避免这种情况,您可以使用默认分区LESS THAN (MAXVALUE)

SQL> CREATE TABLE t (ID NUMBER)
  2  PARTITION BY RANGE (ID)
  3  (  PARTITION t1 VALUES LESS THAN (100),
  4     PARTITION t2 VALUES LESS THAN (200),
  5     PARTITION tmax VALUES LESS THAN (MAXVALUE)
  6  );

Table created

回答by dpbradley

If you're referring to range-partitioned tables and are using 11g, look into defining the tables with interval partitioning. This is similar to range partitioning except that Oracle will create new partitions or split existing partitions automatically for you. If you are on an earlier release then Vincent's suggestion of creating a MAXVALUE partition is the answer for range partitioning.

如果您指的是范围分区表并使用 11g,请考虑使用间隔分区定义表。这类似于范围分区,只是 Oracle 会自动为您创建新分区或拆分现有分区。如果您使用的是早期版本,那么 Vincent 创建 MAXVALUE 分区的建议就是范围分区的答案。