1. 程式人生 > >ORACLE條件表達

ORACLE條件表達

CASE、DECODE
SELECT employee_id,job_id,salary,CASE job_id WHEN ‘AC_MGR’ THEN salary1.2
WHEN ‘IT_PROG’ THEN salary
1.5
WHEN ‘MK_REP’ THEN salary*1.3
ELSE salary
END “Upd_salary”
在這裡插入圖片描述

DECODE
SELECT employee_id,salary,job_id,decode(job_id,‘AC_MGR’,salary1.2,‘IT_PROG’,salary1.5,‘MK_REP’,salary*1.3,salary) Upd_salary
FROM employees;
結果同上所示