Woops, figured it out. Just needed to declare the num_var := ''; On Sep 11, 10:45 pm, Nick <nboutel...@xxxxxxxxx> wrote: > CREATE FUNCTION test() RETURNS text > LANGUAGE plpgsql > AS $$DECLARE > num_var TEXT; > BEGIN > FOR i IN 1..10 LOOP > num_var := num_var || ',' || i; > END LOOP; > RETURN num_var; > END;$$; > > SELECT test(); > > returns NULL -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general