pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexis Paul Bertolini <bertolini@computer.org>
To: pgsql-sql@postgresql.org
Subject: Re: set return function is returning a single record, multiple
Date: Fri, 28 Apr 2006 12:58:55 +0200
Message-ID: <4451F56F.8030608@computer.org> (raw)
In-Reply-To: <A70AE049E81A6A40879D5DC0AC8C38C905FA27A3@venus.infics.com>
References: <A70AE049E81A6A40879D5DC0AC8C38C905FA27A3@venus.infics.com>


> CREATE or replace  FUNCTION ftoc9() RETURNS setof  structrankmaster2  
> LANGUAGE 'plpgsql'
>
>  AS' DECLARE
>
>  rowdata pss%rowtype;
>
> BEGIN for i in 1..3 loop
>
> select * into rowdata from pss ;
>
> return next rowdata ;
>
> end loop;
>
> return;
>
> end';
>
The query should be outside the loop, otherwise you are re-running the 
query each time :-)

Alex



view thread (4+ messages)  latest in thread

Message-ID: <4451F56F.8030608@computer.org>
Permalink:  ../4451F56F.8030608@computer.org/
Also on:    postgresql.org/message-id/4451F56F.8030608@computer.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: bertolini@computer.org
  Subject: Re: set return function is returning a single record, multiple
  In-Reply-To: <4451F56F.8030608@computer.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