2010.09.01 13:42

(oracle)아웃조인에서 IN 처리법


===========================
--아웃터조인에서 IN처리법
===========================
SELECT a.woori_COD, a.EMPLO_NUM, a.EMPLO_NAM
 ,b.brnch_cod, b.brnch_nam
FROM TCMEMPL a
 ,TCMBRNC b
WHERE a.WOORI_cod = '20'
AND a.woori_cod = b.woori_cod(+)
AND a.RALPST_BRCNUM = b.brnch_cod(+)
AND b.brnch_cod(+) IN ('20808','20015')
--에러발생함.


--해결1
---------------------------
AND  (CASE WHEN b.brnch_cod(+) IN ('20808','20015') THEN '1' ELSE '2' END) = '1'

--해결2
---------------------------
AND  DECODE(b.brnch_cod(+), '20808','1','20015','1','2') = '1'

Trackback 0 Comment 0