Skip site navigation (1) Skip section navigation (2)

Re: PL/pgSQL Syntax Problem

From: rolf(dot)ostvik(at)axxessit(dot)no
To: pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org,pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/pgSQL Syntax Problem
Date: 2002-03-08 09:40:47
Message-ID: OFB5D7E6EF.9E3B5803-ONC1256B76.0034E703@axxessit.no (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-interfacespgsql-sql
On 2002-03-04 21:34 Hubert Palme <hubert(dot)palme(at)web(dot)de> wrote :

>CREATE FUNCTION t_nummern(integer) -- Parameter: lfd_nr
>RETURNS text AS '
>  DECLARE
>    lfd_nr ALIAS FOR $1;
>    erg text;
>    daten record;
>  BEGIN
>    erg := '''';
>    FOR daten IN 
>      SELECT * INTO daten FROM telefon WHERE t_lfd_nr = lfd_nr
Remove this     ^^^^^^^^^^
so that the "FOR ... SELECT" is

    FOR daten IN 
      SELECT * FROM telefon WHERE t_lfd_nr = lfd_nr

>    LOOP
>      IF erg <> '''' THEN
>        erg := erg || '', '';
>      END IF;
>      IF daten.t_einrichtg <> '''' THEN
>        erg := erg || daten.t_einrichtg || '': '';
>      END IF;
>      erg := erg || ''('' || daten.vorwahl || '') '' || daten.telefon_nr;
>    END LOOP;
>    RETURN erg;
>  END;'
>LANGUAGE 'plpgsql';

regards
-- 
Rolf

pgsql-sql by date

Next:From: Andrew McMillanDate: 2002-03-08 11:35:41
Subject: Re: Bad Query?? Extremely slow response
Previous:From: Carlo FlorendoDate: 2002-03-08 06:57:10
Subject: URGENT! VIRUS ALERT

pgsql-interfaces by date

Next:From: impalaDate: 2002-03-08 10:46:26
Subject: NEWBIE ant build.xml FAILED !!
Previous:From: Nicolas BazinDate: 2002-03-08 07:35:18
Subject: Additional fixes to ecpg - please apply patch

pgsql-general by date

Next:From: =?ISO-8859-1?Q?Enrique_Ariz=F3n_Benito?=Date: 2002-03-08 10:48:07
Subject: Modifying text data?
Previous:From: Marc PolatschekDate: 2002-03-08 08:58:52
Subject: Re: Problem with Subquery

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group