//NULLIF로 NULL값 표현 //같으면null, 다르면 앞에값
SELECT NULLIF('A','A'), NULLIF('A','B') FROM dual;
>>>>(null) >>>>A
//null이 아닌 첫번째 반환식을 반환 //
SELECT ename, salary, commission, COALESCE(commission, salary, 0) FROM employee ORDER BY job;
//DECODE로 부서이름출력
SELECT ename, dno,
DECODE(dno, 10, 'A', 20, 'R', 30, 'S', 40, 'O', 'DEFAULT') AS DNAME
FROM employee ORDER BY dno;
//CASE로 부서이름 출력
SELECT ename, dno,
CASE WHEN dno=10 THEN 'A'
WHEN dno=20 THEN 'B'
WHEN dno=30 THEN 'C'
WHEN dno=40 THEN 'O'
ELSE 'DEFAULT' END AS DNAME
FROM employee ORDER BY dno;