Help with Postgres

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Help with Postgres

Postby pk_fox » Wed Mar 19, 2014 2:48 pm

Hi all, I'm cutting my teeth with postgres and want some help with defining a function thst returns columns from various tables, I've googled for ages and can't find a simple answer, I have a query as shown below

Code: Select all
CREATE OR REPLACE FUNCTION dbo.spgetallemployees() RETURNS SETOF ? AS
$BODY$SELECT
  employee.id,
  employee.firstname,
  employee.lastname,
  employee.city,
  employee.genderid,
  employee.dateofbirth,
  employee.departmentid,
  employee.createdate,
  employee.createuser,
  employee.amenddate,
  employee.amenduser,
  department.departmentname,
  genders.gendername
FROM
  dbo.employee,
  dbo.department,
  dbo.genders
WHERE
  employee.departmentid = department.departmentid AND
  employee.genderid = genders.genderid
ORDER BY
  employee.departmentid DESC;
$BODY$
LANGUAGE sql VOLATILE NOT LEAKPROOF
COST 100
ROWS 1000;


what do I need to specify in returns setof ?, this just works in other db's without specifying a type - all help gratefully appreciated
We can't stop here, this is bat country. Hunter S Thompson RIP.
User avatar
pk_fox
LXF regular
 
Posts: 292
Joined: Wed Apr 13, 2005 1:38 pm
Location: Surrey, UK

Return to Help!

Who is online

Users browsing this forum: theocl and 2 guests