I am completely disappointed with the results of this query:
select count(*) from my_tab mt where mt.stat = '2473' and mt.name= 'Tom' and exists (select * from company_users@colink.world cu, personnel_records@colink.world pr where cu.user_id = pr.user_id and mt.name = pr.name and mt.stat = cu.stat )
Returns: 1
There are 0 entries in company_users@colink.world with stat = '2473', so why does it return true for an existing one?
If I changed the request like this, it returns 0:
select count(*) from my_tab mt where mt.stat = '2473' and mt.name= 'Tom' and exists (select * from company_users@colink.world cu, personnel_records@colink.world pr where cu.user_id = pr.user_id and mt.name = pr.name and cu.stat = '2473' )
UPDATE Okay, this is really weird. To see what happens, I executed a query from another database (the one referenced by the database links) and gave different (correct) results.
select count(*) from my_tab@mylink.world mt where mt.stat = '2473' and mt.name= 'Tom' and exists (select * from company_users cu, personnel_records pr where cu.user_id = pr.user_id and mt.name = pr.name and mt.stat = cu.stat )
Returns 0 (as expected).
source share