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