Search code examples
oracle-databasedatapump

How to import table in different number of columns?


I'm using data pump export/import method in Oracle 11GR2

So, I have table A containing (ID, Name, Address, City, Phone) and I want to export it into table B (ID, Name, Address).

How can I import data from table A to table B that have different number of columns in table B???

It always gives me error ORA-39112 :(

Please help me guys..#newbie here

Here's my code:

expdp USERID="admin"@orcl DIRECTORY=dmpdir TABLES="A"."table_a"
      FILE=tb_a.dmp GRANTS=Y ROWS=Y LOG=exportTables.log

impdp USERID="admin"@target FULL=Y CONSTRAINTS=Y FILE=tb_a.dmp
      IGNORE=Y GRANTS=Y ROWS=Y COMMIT=Y LOG=importTables.log 

Solution

  • Mainly this is about ETL. If I were you I would import it into the same table ("table_a") as well and then move the data from this table to the desired one ("table_b") with a PL/SQL procedure.