I found this function on line [Thanks to Jeff Eckermann and Juerg Rietmann] that takes the results of a query and creates a comma delimited string. However when I run it I get no values. Any help would be appreciated. I apologize if this is the wrong forum.
Jeff Ruff
Tycoelectronics Power Systems
Function:
DROP FUNCTION userinfo.group_list(text);
CREATE FUNCTION userinfo.group_list(text) RETURNS text AS'
DECLARE
rec RECORD;
string text := NULL;
BEGIN
FOR rec IN SELECT * FROM userinfo.userdb_groups WHERE username = $1 LOOP
string := string || rec.groupname || \',\';
END LOOP;
string := substr(string, 1, length(string)-1);
RETURN string;
END;
'LANGUAGE 'plpgsql';
Acts on database listing name userdb_groups
key username groupname
==== ======= ========
1023 jruff srcadm
1024 jruff libadm
1025 jruff mpdev
1026 jruff systems
1027 jruff ug
1027 jruff cadadm
1028 jruff mppm
1029 jruff corerd
1030 jruff weblive
Jeff Ruff
Tyco Electronics Power Systems, Inc.
CAD Support Group
phone: 972-284-4267
email: jeffry.ruff@xxxxxxxxxxxxxxxxxxx