function returns no results - Mailing list pgsql-novice

From richard@xentu.com
Subject function returns no results
Date
Msg-id 6030d35333971e0a4efa7def4d55d37a@xentu.com
Whole thread Raw
Responses Re: function returns no results  (Andreas Kretschmer <akretschmer@spamfence.net>)
List pgsql-novice
Could anyone tell me what I'm doing wrong here?
I have a table, that does indeed contain data:

SELECT last_name, first_name, email, department, salary from employees
where department='Engineering';

returns 4 rows.
I've also tried to define a function that should return a table:

CREATE OR REPLACE FUNCTION get_employees_for_department(IN
the_department character varying)
   RETURNS TABLE(last_name character varying, first_name character
varying, email character varying, department character varying, salary
numeric) AS
$BODY$
begin
return query SELECT last_name, first_name, email, department, salary
from employees where department=the_department;
end
$BODY$
   LANGUAGE plpgsql;


However, when I try using that function:

select * from get_employees_for_department('Engineering');

No rows are returned.

Regards
Richard


pgsql-novice by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Compiling with Visual C++
Next
From: Andreas Kretschmer
Date:
Subject: Re: function returns no results