problem with RECORD in a stored procedure

From: Dalton Shane <se401029(at)cs(dot)may(dot)ie>
To: pgsql-sql(at)postgresql(dot)org
Subject: problem with RECORD in a stored procedure
Date: 2002-03-08 15:06:16
Message-ID: 200203081502.PAA28287@cs.may.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


HI,

I have a strange problem with regard to the RECORD type. IN plpgsql language it
doesn't seem to recognise the data type. Does anybody have any idea why? I've
included a sample function and the terminal output to show what I mean. I've
also included what should have gone into table orla.

Any help would be appreciated in sorting out this frustrating problem.

Shane

CREATE FUNCTION sinead() RETURNS integer AS '
DECLARE
a integer :=0;
b RECORD;


BEGIN
FOR b IN SELECT MIN(total) from results LOOP
INSERT INTO orla(total) VALUES(b);
END LOOP;

RETURN a;


END;
' LANGUAGE 'plpgsql';

-------------------------------------------------------------------------

ballina=# select sinead();
ERROR: Attribute 'b' not found

--------------------------------------------------------------------------
ballina=# select MIN(total) from results;
min
-----
2
(1 row)

---------------------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2002-03-08 16:16:10 Re: problem with RECORD in a stored procedure
Previous Message jmycr 2002-03-08 14:13:31 'now' problem