Re: PL/pgSQL Syntax Problem

From: hubert(dot)palme(at)web(dot)de (Hubert Palme)
To: Jan Wieck <janwieck(at)yahoo(dot)com>
Cc: Hubert Palme <hubert(dot)palme(at)web(dot)de>, 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-05 20:33:44
Message-ID: 15493.11176.438179.736883@palme-pc.urz.Uni-Wuppertal.DE
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-interfaces 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(dot)palme(at)web(dot)de>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message gelinas 2002-03-05 22:08:26 Index not used with user
Previous Message Ulrich Wisser 2002-03-05 20:22:05 Re: vacuum statistics

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jim Parker 2002-03-05 23:08:22 Linking ECPG files to a C program
Previous Message Tom Lane 2002-03-05 16:03:57 Re: Error passing parameter to functions

Browse pgsql-sql by date

  From Date Subject
Next Message Kovacs Zoltan 2002-03-05 22:49:55 Re: getting pid of backend
Previous Message Josh Berkus 2002-03-05 18:21:58 Re: getting pid of backend