Re: Functions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nick Jones <neckjonez(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Functions
Date: 2005-05-31 18:47:21
Message-ID: 17062.1117565241@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Nick Jones <neckjonez(at)gmail(dot)com> writes:
> CREATE FUNCTION test2(VARCHAR) RETURNS SETOF TEXT AS
> '
> DECLARE
> r record;
> BEGIN
> FOR r IN
> select router_name from router where router_name ~ $1
> LOOP
> RETURN NEXT r;
> END LOOP;
> RETURN;
> END;
> ' LANGUAGE 'plpgsql';

Close, but you want "RETURN NEXT r.router_name". r is a record
potentially containing several fields, you have to say which you
want.

regards, tom lane

In response to

  • Functions at 2005-05-26 20:07:36 from Nick Jones

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nick Jones 2005-05-31 18:52:01 Re: Functions
Previous Message John DeSoi 2005-05-31 18:45:15 Re: Functions