나는 완전히이 쿼리의 결과에 당황 해요 :Oracle EXISTS 쿼리가 예상대로 작동하지 않습니다. - DB Link bug?
select count(*) from my_tab mt
where mt.stat = '2473'
and mt.name= 'Tom'
and exists (select * from [email protected] cu,
[email protected] pr
where cu.user_id = pr.user_id
and mt.name = pr.name
and mt.stat = cu.stat
)
반환 값 :이 = '2473'를 통계에 [email protected] 0 기록, 그래서 왜 반환 한
존재에 대한 진실? 그래서, 그것은 0을 반환처럼 쿼리를 변경하는 경우
는 :
select count(*) from my_tab mt
where mt.stat = '2473'
and mt.name= 'Tom'
and exists (select * from [email protected] cu,
[email protected] pr
where cu.user_id = pr.user_id
and mt.name = pr.name
and cu.stat = '2473'
)
UPDATE를가 좋아, 이건 정말 이상해. 무슨 일이 일어날 지 알기 위해 다른 데이터베이스 (DB Links에서 참조하는 쿼리)에서 쿼리를 실행하고 다른 결과 (정확한)를주었습니다.
select count(*) from [email protected] 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
)
0 (예상대로)을 반환합니다.
실행중인 Oracle 버전과 플랫폼을 인용해야합니다. –
테이블 정의를 제공 할 수 있습니까? –
@Jonathan 10g을 사용하고 있으며 SQL Developer에서이 쿼리를 실행하고 있습니다. –