Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005

    Unanswered: Insert Data from another schema

    Dear Sir,

    I have two different databases aic with user orion7402 and test with user orion7402 on two different pc's , two months back i created database test and i imported all the data from aic database user orion7402 into test database with same username orion7402 and my problem is i have inserted some records in one table in user orion7402 at test database and now i want to insert those values into the same table in aic database user .Can somebody help me in writing this insert statement.
    Best Regards

  2. #2
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    Do those databases see each other? I mean, are they accessible through network? If so, create a database link, give appropriate GRANTs and that might be OK. Query would look like this (insert records that are in TEST DB, but not in AIC DB):

    INSERT INTO aic_table
    SELECT * FROM test_table
    SELECT * FROM aic_table;

    If they are independent (which might be the case), you might need a step or two in between: export table on TEST DB and import it into AIC DB (NOT into the same schema as you'll duplicate data (if no unique key is present)), or - to import table into the same schema, first (in the TEST DB) create auxiliary table with different name and then import it into the AIC schema. Something like this:

    CREATE TABLE aux_test_table AS SELECT * FROM test_table;
    EXP un/pw TABLES=aux_test_table FILE=test.dmp
    Copy export file to AIC PC
    IMP un/pw FILE=test.dmp

    INSERT INTO aic_table
    SELECT * FROM aux_test_table
    SELECT * FROM aic_table;

    Does this make any sense? Because the answer seems to be confusing just like the question

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts