안녕하세요 ~
PROCEDURE CAPA_SELECT ( P_CURSOR OUT TYPES.TCURSOR
, W_SOB_ID IN NUMBER
, W_ORG_ID IN NUMBER
, W_WORKCENTER_ID IN NUMBER
, W_ENABLED_FLAG IN VARCHAR2
, W_NO_ENROLL_FLAG IN VARCHAR2
)
IS
V_LOCAL_DATE DATE := TRUNC(GET_LOCAL_DATE(W_SOB_ID));
BEGIN
OPEN P_CURSOR FOR
SELECT SSW.WORKCENTER_CODE
, SSW.WORKCENTER_DESCRIPTION
, WWC.MONTHLY_CAPA_MM
, 'MM/Month' AS CAPA_UOM
, WWC.REMARK
, WWC.EFFECTIVE_DATE_FR
, WWC.EFFECTIVE_DATE_TO
, WWC.ENABLED_FLAG
, WWC.WORKCENTER_CAPA_ID
, SSW.WORKCENTER_ID
FROM SDM_STANDARD_WORKCENTER SSW
, WIP_WORKCENTER_CAPA WWC
WHERE WWC.WORKCENTER_ID(+) = SSW.WORKCENTER_ID
AND SSW.SOB_ID = W_SOB_ID
AND SSW.ORG_ID = W_ORG_ID
AND ((W_WORKCENTER_ID IS NULL AND 1 = 1)
OR (W_WORKCENTER_ID IS NOT NULL AND SSW.WORKCENTER_ID = W_WORKCENTER_ID))
AND ((W_ENABLED_FLAG = 'N' AND 1 = 1)
OR (W_ENABLED_FLAG != 'N' AND (WWC.ENABLED_FLAG = 'Y'
AND WWC.EFFECTIVE_DATE_FR <= V_LOCAL_DATE
AND NVL(WWC.EFFECTIVE_DATE_TO, V_LOCAL_DATE) >= V_LOCAL_DATE)))
AND ((W_NO_ENROLL_FLAG != 'Y' AND 1 = 1)
OR (W_NO_ENROLL_FLAG = 'Y' AND
NOT EXISTS
( SELECT 'X'
FROM WIP_WORKCENTER_CAPA WC
WHERE WC.WORKCENTER_ID = SSW.WORKCENTER_ID
)))
;
END CAPA_SELECT;
인데요 궁금한점은 where 절부터 입니다.
where 절에 아우터조인걸고 그다음 and에 sob, org 이건 그냥 패스하셔도 되는데
W_WORKCENTER_ID가 널값 에 트루 가 나오거나
또는 널값이 아니고 WORKCENTER_ID = W_WORKCENTER_ID 한다..???
또 그밑에 ENABLED FLAG 도 못알아듣기는 마찬가지.. 제가 왕초보라 그러는데 where절부터 차근차근 설명해 주실수있는 능력자분을 찾습니다.. ㅠㅠ