Re: PL/pgSQL Syntax Problem - Mailing list pgsql-sql

From hubert.palme@web.de (Hubert Palme)
Subject Re: PL/pgSQL Syntax Problem
Date
Msg-id 15493.11176.438179.736883@palme-pc.urz.Uni-Wuppertal.DE
Whole thread Raw
In response to PL/pgSQL Syntax Problem  (Hubert Palme <hubert.palme@web.de>)
List pgsql-sql
Thanks to all who answered -- you solved my problemn :-)

Hubert

 > Hubert Palme wrote:
 >> Hi,
 >>
 >> this function:
 >>
 >> 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
 >> 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';
 >>
 >> causes the following error:
 >>
 >> mitglieder=> select t_nummern(330);
 >> ERROR:  query "SELECT  * INTO daten FROM telefon WHERE t_lfd_nr =  $1 "
 >> isn't a
 >> SELECT
 >> mitglieder=>
 >>
 >> Why isn't this a SELECT??

--
Hubert Palme                           Am Walde 1
                                 42119 Wuppertal
<hubert.palme@web.de>

pgsql-sql by date:

Previous
From: Ismail Bouabdallah
Date:
Subject: function error: ERROR:  fmgr_info: function 56664:cache lookup failed
Next
From: "Ivan Manuel Andrade Muñoz"
Date:
Subject: to unsubcribe?