Case when in Oracle

20 Views Asked by At
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

1

There are 1 best solutions below

0
Ana GH On BEST ANSWER

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