-- Function: getallfoobar() -- DROP FUNCTION getallfoobar(); CREATE OR REPLACE FUNCTION getallfoobar3(foo OUT foo,bar OUT bar) RETURNS SETOF record AS $BODY$ DECLARE r foo%rowtype; r1 bar%rowtype; BEGIN FOR r IN SELECT * FROM foo WHERE fooid > 3 LOOP -- can do some processing here RAISE NOTICE 'r == %',r; -- return next row of SELECT' getallfoobar3.foo = r; END LOOP; FOR r1 IN SELECT * FROM bar WHERE barid > 0 LOOP -- can do some processing here -- return next row of SELECT RAISE NOTICE 'r1 == %',r1; END LOOP; getallfoobar3.bar = r1; RETURN NEXT; END $BODY$ LANGUAGE plpgsql VOLATILE COST 100 ROWS 1000; /Thanks for your help ../ *But still i want output in record here i am getting only last record in ouput ...* -- View this message in context: http://postgresql.1045698.n5.nabble.com/RETURNING-MORE-THAN-ONE-CUSTOM-TYPE-FROM-FUNCTION-tp5712546p5713149.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general