I'm trying to code a query which will display employees who work as developers ('%_PROG'
) or managers ('%_MAN'
). My query is fine except for the 2nd line with CASE WHEN THEN
. I'm getting the error message:
ORA-00923 FROM keyword not found where expected
so the problem must be with the second line, which is:
(CASE WHEN JOB_ID LIKE '%_PROG' THEN "Developer" ELSE "Manager" END) JOB_ID
Here is the whole query:
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;
The output should look like:
Employee# 103 named Anna Clark who is Developer will have a new salary of $006,100
What am I doing wrong?
Try to use single quotes in our statement:
(CASE WHEN JOB_ID LIKE '%_PROG' THEN 'Developer' ELSE 'Manager' END) JOB_ID