该行要求c.X_ID等于常数值,或者C表中没有记录。当然,由于它保持联接状态,因此它不会限制A表中的记录,而只会限制C表中已联接的记录。这是一个示范:
设定:
CREATE TABLE T1 as (select rownum+1 t1_id from dual connect by rownum <= 4);
CREATE TABLE T2 as (
select rownum t1_id, DECODE(rownum,2,'CONSTANT',3,'NoMatch') CompareField
from dual connect by rownum <= 3
);
SELECT * FROM T1;
SELECT * FROM T2;
结果:
SELECT T1.t1_id, T2.t1_id, T2.CompareField
FROM T1, T2
WHERE T1.t1_id = T2.t1_id(+)
AND 'CONSTANT' = T2.CompareField(+)
ORDER BY 1;
要么:
SELECT T1.t1_id, T2.t1_id, T2.CompareField
FROM T1 LEFT JOIN T2 ON T1.t1_id = T2.t1_id
AND 'CONSTANT' = T2.CompareField
ORDER BY 1;