我正在尝试编写一个查询,该查询将显示作为开发人员 ( '%_PROG'
) 或经理 ( '%_MAN'
) 工作的员工。我的查询很好,除了第二行带有CASE WHEN THEN
. 我收到错误消息:
ORA-00923 FROM 关键字未在预期位置找到
所以问题一定出在第二行,即:
(CASE WHEN JOB_ID LIKE '%_PROG' THEN "Developer" ELSE "Manager" END) JOB_ID
这是整个查询:
SELECT 'Employee# ' || EMPLOYEE_ID
|| ' named ' || FIRST_NAME
|| ' ' || LAST_NAME || ' who is '
|| CASE WHEN JOB_ID LIKE '%_PROG' THEN "Developer" ELSE "Manager" END
|| ' will have a new salary of $'
|| ROUND((SALARY +((SALARY/100)*25)),-2) AS "Employees with higher salary"
FROM EMPLOYEES
WHERE JOB_ID LIKE '%_PROG' OR JOB_ID LIKE '%_MAN'
AND (SALARY >= 3000 AND SALARY <= 5000)
ORDER BY EMPLOYEE_ID;
输出应如下所示:
Employee# 103 named Anna Clark who is Developer will have a new salary of $006,100
我究竟做错了什么?