( SELECT CASE WHEN CL_DT IS NULL THEN
CASE WHEN ( SELECT TO_NUMBER(TO_CHAR(TO_DATE( '2015' /**P*/, 'YYYY'),'YYYY')) FROM DUAL ) -- 입력년도
>= ( SELECT TO_NUMBER(TO_CHAR( SYSDATE ,'YYYY')) FROM DUAL ) THEN
( SELECT TO_NUMBER(TO_CHAR( SYSDATE, 'MM')) MON FROM DUAL )
ELSE 12 END
ELSE
CASE WHEN ( SELECT TO_NUMBER(TO_CHAR(TO_DATE( '2015' /**P*/, 'YYYY'),'YYYY')) FROM DUAL ) -- 입력년도
= ( SELECT TO_NUMBER(TO_CHAR(TO_DATE( CL_DT, 'YYYYMMDD'),'YYYY' )) FROM DUAL ) THEN
( SELECT ROUND( MONTHS_BETWEEN(TO_DATE( CL_DT,'YYYYMMDD'), TO_DATE( '20160101', 'YYYYMMDD' )), 0 ) MON FROM dual )
ELSE 12 END
END
FROM DUAL ) MON
이거 해석좀 부탁드려요 ㅠㅠ
|