0
DECLARE 
eno integer := 0;
emp string ;

select into eno emp_no from "public"."salaries" GROUP BY emp_no ORDER BY max(salary) DESC LIMIT 1;
-- gives the emp_no of the employee with maximim salary

select INTO emp CONCAT(first_name, ' ' , last_name) as "Name" from "employees" 
WHERE emp_no = eno;
-- gives the name of the employee with the emp_no from preveous result 

raise NOTICE "The Employe with maximum salary is %",emp;

Error message : ERROR: syntax error at or near "integer"

i tried to get the emp name with maximum salary please help

1 Answers1

0

You need to separate your declarations from your initialization of values.

Do this:

DECLARE 
   eno integer;
BEGIN
   eno := 0;
... rest of your code here
END;
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225