ora-00923

Case when in Oracle


select FIRST_NAME,LAST_NAME,SALARY
Case
  When SALARY > 15000 then 'high' 
  When SALARY < 10000 then 'low'
  ELSE 'super low'
  END As salary_group
 from hr.employees

On running the query, I get the follwoing:

ORA-00923: FROM keyword not found where expected

table


Solution

  • There's a syntax error in your query, you need a comma after SALARY column:

    select FIRST_NAME,LAST_NAME,SALARY,
        Case
          When SALARY > 15000 then 'high' 
          When SALARY < 10000 then 'low'
          ELSE 'super low'
          END As salary_group
         from hr.employees