Functions returning RECORD - Mailing list pgsql-general

From Craig Bryden
Subject Functions returning RECORD
Date
Msg-id 001001c4f999$80d08c00$77d417c4@amd2800
Whole thread Raw
Responses Re: Functions returning RECORD  (Michael Fuhr <mike@fuhr.org>)
Re: Functions returning RECORD  (Pavel Stehule <stehule@kix.fsv.cvut.cz>)
Re: Functions returning RECORD  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List 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
 

pgsql-general by date:

Previous
From: "Ed L."
Date:
Subject: Re: vacuum vs open transactions
Next
From: "Rick Schumeyer"
Date:
Subject: best place to enfore rules