NVL(aa01.NM,'') 은 아무 의미 없는 구문입니다. aa01.NM 과 같습니다.
SELECT pstn_nm
, pr_action_exec_chps_empno
, nm
, pr_objt_grp_nm
, pr_objtr_nm
, MIN(DECODE(rn,1,pr_detl1_sn)) pr_detl1_sn_1
, MIN(DECODE(rn,2,pr_detl1_sn)) pr_detl1_sn_2
, MIN(DECODE(rn,3,pr_detl1_sn)) pr_detl1_sn_3
, MIN(DECODE(rn,4,pr_detl1_sn)) pr_detl1_sn_4
, MIN(DECODE(rn,5,pr_detl1_sn)) pr_detl1_sn_5
, MIN(DECODE(rn,6,pr_detl1_sn)) pr_detl1_sn_6
, MIN(DECODE(rn,1,pr_detl2_sn)) pr_detl2_sn_1
, MIN(DECODE(rn,2,pr_detl2_sn)) pr_detl2_sn_2
, MIN(DECODE(rn,3,pr_detl2_sn)) pr_detl2_sn_3
, MIN(DECODE(rn,4,pr_detl2_sn)) pr_detl2_sn_4
, MIN(DECODE(rn,5,pr_detl2_sn)) pr_detl2_sn_5
, MIN(DECODE(rn,6,pr_detl2_sn)) pr_detl2_sn_6
FROM (SELECT c01.pstn_nm
, b01.pr_action_exec_chps_empno
, aa01.nm
, pr_objt_grp_nm
, pr_objtr_nm
, DECODE(pr_detl1_sn,'1','직접면담','2','유선통화') pr_detl1_sn
, DECODE(pr_detl2_sn,'1','긍정','2','보통','3','부정') pr_detl2_sn
, ROW_NUMBER() OVER(PARTITION BY c01.pstn_nm
, b01.pr_action_exec_chps_empno
, aa01.nm
, pr_objt_grp_nm
, pr_objtr_nm
ORDER BY pr_detl1_sn
, pr_detl2_sn
) rn
FROM tbetcb02 b02
, mvwtbetkc0801 c01
, tbetcb01 b01
, tbetkc07 aa01
, tbetca01 a01
WHERE b02.pr_mgmt_pr_ym = '2008'
AND b02.pr_kind_cd = '1'
AND b02.pr_mgmt_sn = '4'
AND b02.pr_objt_blg_cd = '0714000'
AND b02.pr_objt_grp_cd = '01'
AND b02.pr_objt_sn = '249'
AND b02.pr_objt_blg_cd = c01.pstn_cd
AND b02.pr_mgmt_pr_ym = b01.pr_mgmt_pr_ym
AND b02.pr_kind_cd = b01.pr_kind_cd
AND b02.pr_mgmt_sn = b01.pr_mgmt_sn
AND b01.pr_action_exec_chps_empno = aa01.emp_no(+)
AND b02.pr_objt_blg_cd = a01.pr_objt_blg_cd
AND b02.pr_objt_grp_cd = a01.pr_objt_grp_cd
AND b02.pr_objt_sn = a01.pr_objt_sn
)
GROUP BY pstn_nm
, pr_action_exec_chps_empno
, nm
, pr_objt_grp_nm
, pr_objtr_nm