Home » SQL & PL/SQL » SQL & PL/SQL » comparing data of the table using DBLINK
comparing data of the table using DBLINK [message #231293] Mon, 16 April 2007 05:16 Go to next message
Messages: 28
Registered: June 2005
Location: Delhi
Junior Member

Hi !
I have to compare the data of two tables which are in two different databases like db1,db2 and the user are user1, user2 respectively and the table name is item_mast which is in both the databases. I have to compare the item_cd(unique) column of both the table,and i have to display the items which are in item_mast(db1) but not in item_mast(db2).

For this i have made a dblink named db2_dblink by using the following query :

create database link db2_dblink
connect to user1
identified by user1
using db2;

And now i m executing the following query :

select item_cd from item_mast
where item_company_code='PP'
and item_location_code='L043'
and item_financial_year_code='20062007'
and item_cd NOT IN (select a.item_cd from item_mast@db2_dblink a
where a.item_company_code='BB'
and a.item_location_code='L012'
and a.item_financial_year_code='20062007');

Please tell me whether i m doing the things in the right manner or not.....or pls suggest me the other option.

Thanks & Regards
Re: comparing data of the table using DBLINK [message #231299 is a reply to message #231293] Mon, 16 April 2007 05:39 Go to previous message
Michel Cadot
Messages: 64610
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
select item_cd from item_mast
select item_cd from item_mast@dblink

Previous Topic: how to use dbs.random package effectively?
Next Topic: Query problem
Goto Forum:

Current Time: Sun Mar 26 02:26:53 CDT 2017

Total time taken to generate the page: 0.11999 seconds