DECODE
SELECT EMPNO, ENAME, JOB, SAL,
DECODE(JOB,
'MANAGER', SAL * 1.1,
'SALESMAN', SAL * 1.05,
SAL * 1.03) AS UPSAL
FROM EMP;
decode 마지막 param은 default값
CASE문
--예시1
SELECT EMPNO, ENAME, JOB, SAL,
CASE JOB
WHEN 'MANAGER' THEN SAL * 1.1
WHEN 'SALESMAN' THEN SAL * 1.05
ELSE SAL * 1.03
END AS UPSAL
FROM EMP;
--예시2
SELECT EMPNO, ENAME, JOB, SAL,
CASE
WHEN COMM IS NULL THEN '해당 없음'
WHEN COMM >= 0 THEN COMM
END AS UPSAL
FROM EMP;