Re: Still don't know how to build this string ? how to concat ??

From: juerg(dot)rietmann(at)pup(dot)ch
To: Michael Fork <mfork(at)toledolink(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-sql-owner(at)postgresql(dot)org
Subject: Re: Still don't know how to build this string ? how to concat ??
Date: 2001-03-27 09:20:18
Message-ID: OFE5DBC589.2179BDB8-ONC1256A1C.0032B55B@pup.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
============================================

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message juerg.rietmann 2001-03-27 09:35:30 Re: Still don't know how to build this string ?
Previous Message Marcin Kowalski 2001-03-27 09:03:07 pg_dump potential bug