SELECT
FLOOR(
MONTHS_BETWEEN(
SYSDATE,
TO_DATE(
CONCAT (
(
CASE WHEN SUBSTR(SOCIAL_DATE, 7, 1) IN ('1', '2', '5', '6') THEN '19'
WHEN SUBSTR(SOCIAL_DATE, 7, 1) IN ('3', '4', '7', '8') THEN '20'
WHEN SUBSTR(SOCIAL_DATE, 7, 1) IN ('9', '0') THEN '18' END
),
SUBSTR(SOCIAL_DATE, 1, 6)
),
'YYYYMMDD'
)
)/ 12
) AS AGE
FROM TBL_MEMBER
0 댓글