Compare tables and insert the differnce into table
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: Compare tables and insert the differnce into table

  1. #1
    Join Date
    Oct 2008
    Posts
    15

    Compare tables and insert the differnce into table

    I have two tables say A in database X and A in database Y..I want to insert the records from table A in database Y into table A in X database.

    i tried the minus option it gives unique constraint violated error...If i try append option in impdp still it gives same error..can any one help?

  2. #2
    Join Date
    Dec 2002
    Posts
    60
    That means your MINUS statement is not returning right result set. Are you using DBLINK to use MINUS query?.

  3. #3
    Join Date
    Oct 2008
    Posts
    15
    Yes..I am using DB link

  4. #4
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    3,999
    Try using the merge command. you tell it how to handle conflicts. If a record does not exist there is an insert clause, if a record does exist there is an update clause, etc.
    this space intentionally left blank

  5. #5
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    Quote Originally Posted by mohith2009 View Post
    I have two tables say A in database X and A in database Y..I want to insert the records from table A in database Y into table A in X database.

    i tried the minus option it gives unique constraint violated error...If i try append option in impdp still it gives same error..can any one help?
    Chances are that table Y.A is a child table - is there a Referential Integrity constraint pointing to a parent table in Y database? e.g. FK?

    If this is the case you have to insert the parent rows first.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

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



Click Here to Expand Forum to Full Width