DECODE(비교할컬럼, 조건1,값1,조건2,값2, 디폴트)
DECODE(TT.TYPE, 1, '내국인', 2,'외국인','그외')
CASE WHEN 컬럼 조건1 THEN 값1
WHEN 컬럼 조건2 THEN 값2
ELSE 디폴트
END
-- 널체크인경우
(CASE WHEN CNT IS NOT NULL AND ACODE IS NULL THEN '1'
WHEN CNT IS NULL AND ACODE IS NOT NULL THEN '2'
WHEN CNT IS NOT NULL AND ACODE IS NOT NULL THEN '3'
ELSE '0'
END
) AS ABS_AR
-- 값 체크인경우
select (CASE WHEN col1 < 50000001 THEN 1
WHEN col1 > 50000000 AND col1 < 100000001 THEN 2
ELSE 3
END ) as type
from TEMPTB
DECODE(TT.TYPE, 1, '내국인', 2,'외국인','그외')
CASE WHEN 컬럼 조건1 THEN 값1
WHEN 컬럼 조건2 THEN 값2
ELSE 디폴트
END
-- 널체크인경우
(CASE WHEN CNT IS NOT NULL AND ACODE IS NULL THEN '1'
WHEN CNT IS NULL AND ACODE IS NOT NULL THEN '2'
WHEN CNT IS NOT NULL AND ACODE IS NOT NULL THEN '3'
ELSE '0'
END
) AS ABS_AR
-- 값 체크인경우
select (CASE WHEN col1 < 50000001 THEN 1
WHEN col1 > 50000000 AND col1 < 100000001 THEN 2
ELSE 3
END ) as type
from TEMPTB
댓글