Skip site navigation (1) Skip section navigation (2)

Returning function results...

From: "Bob Whitehouse" <bwhitehouse(at)geeknest(dot)com>
To: "pgsql-novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Returning function results...
Date: 2001-04-20 19:52:25
Message-ID: 013401c0c9d3$6c187b00$ (view raw or whole thread)
Lists: pgsql-novice
How do I return a record to a function?
When I try to add the function below to my database I get this error:
psql:/path/:825: NOTICE: ProcedureCreate: type 'record' is not yet defined

CREATE FUNCTION get_last_respondent(INT4)
       AS 'DECLARE
                  int_issue_id_var ALIAS FOR $1;
                  rec_person  RECORD;

              SELECT h.who, AS issue, AS histid
              INTO rec_person
              FROM history h, issues iss
              WHERE = int_issue_id_var
              AND = h.issue
              AND h.h_type = 3
              AND h.who <> iss.submitter
              ORDER BY histid DESC;

              RETURN rec_person;
   LANGUAGE 'plpgsql';

Thanks, Bob

pgsql-novice by date

Next:From: Philip HallstromDate: 2001-04-20 21:03:48
Subject: Re: postgres installation on FBSD fails
Previous:From: Tom LaneDate: 2001-04-20 17:50:16
Subject: Re: BUG ? ... CURSOR AS VIEW ... MOVE ... CRASH

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group