While inserting data to a partitioned table, got below error.

 

SQL> insert into RANGE_TAB values(to_date(‘24032016′,’ddmmyyyy’),100);
insert into RANGE_TAB values(to_date(‘24032016′,’ddmmyyyy’),100);
*
ERROR at line 1:
ORA-14400: inserted partition key does not map to any partition

 

Solution:

This error is because, the value which we are trying to insert is not satisfying the partition key range criteria.

Lets check the partition details.

SQL> select partition_name,high_value from dba_tab_partitions where table_name='RANGE_TAB';

PARTITION_NAME HIGH_VALUE
-------------- --------------------------------------------------------------------------------
P3             TO_DATE(' 2016-03-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
P2             TO_DATE(' 2016-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA
P1             TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIA

Here we can see the partition key is defined maximum upto 2016-03-01 00:00:00 . But we are trying to insert 2016-03-24 00:00:00 , which is not getting mapped to any partition. so it is failing.

So to fix it , add another partition, with high_value greater than the value which we are trying to insert.

SQL> alter table RANGE_TAB add partition p4 values less than (to_date(‘01042016′,’ddmmyyyy’));

SQL> insert into RANGE_TAB values(to_date(‘24032016′,’ddmmyyyy’),100);

1 row created.