Re: Still don't know how to build this string ? how to concat ?? - Mailing list pgsql-sql

From juerg.rietmann@pup.ch
Subject Re: Still don't know how to build this string ? how to concat ??
Date
Msg-id OFE5DBC589.2179BDB8-ONC1256A1C.0032B55B@pup.ch
Whole thread Raw
Responses Re: Re: Still don't know how to build this string ? how to concat ??
List pgsql-sql
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
============================================



pgsql-sql by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: pl/pgsql and returning rows
Next
From: juerg.rietmann@pup.ch
Date:
Subject: Re: Still don't know how to build this string ?