简体   繁体   中英

How insert data from a temporary table into partitioned table in oracle/sql using merge statement

I have to write a merge statement to insert data from temporary table to a partitioned table and i'm getting below error:-

Error report - SQL Error: ORA-14400: inserted partition key does not map to any partition

  1. I have to do it session wise and as a result, have to use a temporary table which can not be partitioned.

if your inserts datasets into the partioned table, oracle want to place it into the correct partionen. You must create for the complete period of time partitions like in example for MONTHY partition:

ALTER TABLE sales ADD 
PARTITION sales_q1_2007 VALUES LESS THAN (TO_DATE('01-APR-2007','dd-MON-yyyy')),
PARTITION sales_q2_2007 VALUES LESS THAN (TO_DATE('01-JUL-2007','dd-MON-yyyy')),
PARTITION sales_q3_2007 VALUES LESS THAN (TO_DATE('01-OCT-2007','dd-MON-yyyy')),
PARTITION sales_q4_2007 VALUES LESS THAN (TO_DATE('01-JAN-2008','dd-MON-yyyy'))
;

If you have done this, you can insert the data ass needed. Good luck,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM