oracle外連線的連線運算子(+)
阿新 • • 發佈:2018-11-16
下面這一段程式碼一開始死活不出來,後來經過排查原來是(+)在作祟:
select count(*) from
(select pb.Projid,pb.Cityname as city,pb.Regionname as region,pb.Regintypename,pb.townshipname,pb.Projname,
s.addressname as addressname,s.standardid as standardid,s.PROVINCE as province,
s.CITYNAME as cityname,s.REGIONNAME as regionname,s.ROADS as roads
from Projbase pb,Projnameaddressbase pa,Standardaddress s where pb.projid = pa.projid(+)
and pa.standardid=s.standardid(+)
and pb.Currphase = 400 and pb.Ifhb =0and not exists(select m.projid from Projnameaddressbase m where m.projid=pb.projid)
order by pb.Cityid asc,pb.Projname asc)
後來才發現(+)是oracle外連線的運算子,下面總結一下它的用法:
1、該符號可以放在等號的左面,也可以放在等號的右面,但一定要放在缺少資訊的那一面;
2、該符號僅適用於列,不能用在表示式上;
3、該操作符不能與ON和IN操作符一起使用