Functions that return RECORD type

From: "Craig Bryden" <postgresql(at)bryden(dot)co(dot)za>
To: "pgsql" <pgsql-general(at)postgresql(dot)org>
Subject: Functions that return RECORD type
Date: 2005-01-13 19:46:35
Message-ID: 00a001c4f9a8$97cf8c80$77d417c4@amd2800
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I come from a MS-SQL background and am trying to figure out what is wrong
with the function below:
****************************************************************************
*************
CREATE OR REPLACE FUNCTION GetAccountInfo (p_AccID int)
RETURNS record
AS
$$
DECLARE
r_Return record;
BEGIN
SELECT a.Field1, a.Field2, a.Field4
INTO r_Return
FROM Account
WHERE a.AccID = p_AccID;

RETURN r_Return;
END;
$$
language 'plpgsql';
****************************************************************************
*************
When I run select * from GetAccountInfo (100) I get the following
error message: ERROR: a column definition list is required for functions
returning "record"

please can someone explain to me how to create a column definition list.

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rick Schumeyer 2005-01-13 20:09:08 best place to enfore rules
Previous Message Michael Fuhr 2005-01-13 19:23:42 Re: vacuum vs open transactions