Received: from srvlnx02.pup.ch ([195.15.182.155]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2R9IDw60270; Tue, 27 Mar 2001 04:18:13 -0500 (EST) (envelope-from juerg.rietmann@pup.ch) Subject: Re: Still don't know how to build this string ? how to concat ?? To: Michael Fork Cc: pgsql-sql@postgresql.org, pgsql-sql-owner@postgresql.org X-Mailer: Lotus Notes Release 5.0.5 September 22, 2000 Message-ID: From: juerg.rietmann@pup.ch Date: Tue, 27 Mar 2001 11:20:18 +0200 X-MIMETrack: Serialize by Router on srvlnx02/Pup/ch(Release 5.0.5 |September 22, 2000) at 03/27/2001 11:20:20 AM MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii X-Archive-Number: 200103/545 X-Sequence-Number: 2215 Hello I'm closer to a solution. The query results is : Result: 01 1440 02 1460 03 1398 The values (1440, ...) are the last entries of z_u_umfang for each z_u_typ. This is correct since in the function the list:= ... is overwritten until the last record is read. When I try to concat the list in the manner of list := list || text(rec.z_u_umfang); the zustring is empty ! Thanks for any help ... jr Query : select distinct z_u_typ, buildString(z_u_typ) as zustring from zylinder_umfang Function: CREATE FUNCTION buildString(bpchar) RETURNS text AS ' DECLARE list text; rec record; BEGIN FOR rec IN SELECT z_u_umfang FROM zylinder_umfang WHERE z_u_typ = $1; list := text(rec.z_u_umfang); END LOOP; RETURN list; END; ' LANGUAGE 'plpgsql'; ============================================ PFISTER + PARTNER, SYSTEM - ENGINEERING AG Juerg Rietmann Grundstrasse 22a 6343 Rotkreuz Switzerland phone: +4141 790 4040 fax: +4141 790 2545 mobile: +4179 211 0315 ============================================