On 25/04/2010 20:50, Jeff Ross wrote: > Now I'm *really* confused. I thought the table structure I created at > the beginning of the function was where the results would be returned > to. I tried a variety of queries including select into and create table > but they didn't work either. I think you have to do RETURN NEXT inside the loop: create function.... declare return_row record; ... begin ... for.. loop select ... into return_row; return next return_row; end loop; ... return; end; Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@xxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general