Thank you but CREATE OR REPLACE FUNCTION foofunc() RETURNS setof text AS $$ DECLARE var2 RECORD; cur CURSOR FOR SELECT * from testtbl; BEGIN OPEN cur; LOOP FETCH cur INTO var2; return var2; END LOOP; CLOSE cur; END; $$ LANGUAGE plpgsql; ERROR: RETURN cannot have a parameter in function returning set LINE 10: return var2; HINT: Use RETURN NEXT or RETURN QUERY. so I employed next CREATE OR REPLACE FUNCTION foofunc() RETURNS setof text AS $$ DECLARE var2 text; cur CURSOR FOR SELECT col1 from testtbl; BEGIN OPEN cur; LOOP FETCH cur INTO var2; return next var2; END LOOP; CLOSE cur; END; $$ LANGUAGE plpgsql; and it just sits there Any hints ? Thank you — Armand |