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

out parameter and setof record

From: uran1(at)o2(dot)pl
To: pgsql-general(at)postgresql(dot)org
Subject: out parameter and setof record
Date: 2006-05-30 10:21:27
Message-ID: 1148984487.663801.288270@j33g2000cwa.googlegroups.com (view raw or flat)
Thread:
Lists: pgsql-general
In PostgreSql 8.1 i've tried to use Out parameter but when I've changed
function (added Out parameter)

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

CREATE OR REPLACE FUNCTION reffunc3(FROM_ID in integer,COUNT_ROW OUT
integer) RETURNS SETOF Person AS '
DECLARE
   rec RECORD;
BEGIN

   SELECT count(*) INTO COUNT_ROW FROM Person WHERE ssn>FROM_ID ;

   FOR rec IN SELECT ssn,name  FROM Person WHERE ssn>FROM_ID
     LOOP
       c;RETURN NEXT rec ;
     END LOOP ;

   RETURN ;
END;
' LANGUAGE plpgsql;



--SELECT * from reffunc3(1) ;
----------------------------------------

i've seen :

----
ERROR:  function result type must be integer because of OUT parameters
----

Of course when I change parameter to Integer it must be Record error
appears.

What should I change, and how to call this function?

Mirek


Responses

pgsql-general by date

Next:From: Glauco ManciniDate: 2006-05-30 10:24:00
Subject: R: [ODBC] information request on postgresql --> oracle
Previous:From: Roman NeuhauserDate: 2006-05-30 08:51:41
Subject: Re: DB structure for logically similar objects in different

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