pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hubert Palme <hubert.palme@web.de>
To: pgsql-general@postgresql.org.pgsql-interfaces
Subject: PL/pgSQL Syntax Problem
Date: Mon, 4 Mar 2002 21:34:25 +0100
Message-ID: <a60loh$6o5$1@jupiter.hub.org> (raw)

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??

Thanks in advance,

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



view thread (6+ messages)  latest in thread

Message-ID: <a60loh$6o5$1@jupiter.hub.org>
Permalink:  ../a60loh$6o5$1@jupiter.hub.org/
Also on:    postgresql.org/message-id/a60loh$6o5$1@jupiter.hub.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: hubert.palme@web.de, pgsql-general@postgresql.org.pgsql-interfaces
  Subject: Re: PL/pgSQL Syntax Problem
  In-Reply-To: <a60loh$6o5$1@jupiter.hub.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox