I have two DB schemas with same structures, and I would like to compare the contents of one table in the two schemas as follows.
I have created on schema1 (ORACLE_SID=schema1) a Database Link to schema2(ORACLE_SID=schema2) using alias schema2.
I tried running the following queries
Unforunately, the query seems to take forever to run.
Note, there are more records in the stock table in schema1 than in schema2, so the number of records needed to be pulled back should be less than that if I have the DB link the other way round.
any ways of speeding up the query?
I have created on schema1 (ORACLE_SID=schema1) a Database Link to schema2(ORACLE_SID=schema2) using alias schema2.
I tried running the following queries
Code:
SELECT
code
FROM
stock
WHERE
code
NOT IN
(SELECT
code
FROM
stock@schema2);
Unforunately, the query seems to take forever to run.
Note, there are more records in the stock table in schema1 than in schema2, so the number of records needed to be pulled back should be less than that if I have the DB link the other way round.
any ways of speeding up the query?