user1457821
user1457821

Reputation: 33

Copy data from one column from database A table A to another database B table B

I am trying to copy and replace column C from Database A table A to another Database B table B ...

Please note column C exist in both databases we are trying to replace it.

Database A uses different credentials and database B uses different credentials.

Here is what we are trying to work with ... problem is how we handle connections within the database and how we can replace the column

UPDATE B SET B.name = (SELECT A.name FROM A WHERE A.id = A.id AND A.name IS NOT NULL) WHERE B.name IS NULL;

Please let us know

Upvotes: 0

Views: 55

Answers (1)

Multisync
Multisync

Reputation: 8797

You can use a database link to handle connections:
https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5005.htm

UPDATE B SET B.name = 
             (SELECT A.name FROM A@link_name 
              WHERE A.id = A.id AND A.name IS NOT NULL) 
WHERE B.name IS NULL;

Upvotes: 1

Related Questions