Re: set return function is returning a single record, multiple

From: Alexis Paul Bertolini <bertolini(at)computer(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: set return function is returning a single record, multiple
Date: 2006-04-28 10:58:55
Message-ID: 4451F56F.8030608@computer.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Emils 2006-04-28 13:23:53 Outer joins?
Previous Message A. Kretschmer 2006-04-28 10:56:21 Re: set return function is returning a single record, multiple times, how can i get all the records in the table( description inside )