From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: set return function is returning a single record, multiple times, how can i get all the records in the table( description inside )
Date: Fri, 28 Apr 2006 12:56:21 +0200
Message-ID: <20060428105621.GD8542@webserv.wug-glas.de> (raw)
In-Reply-To: <A70AE049E81A6A40879D5DC0AC8C38C905FA27A3@venus.infics.com>
References: <A70AE049E81A6A40879D5DC0AC8C38C905FA27A3@venus.infics.com>
am 28.04.2006, um 16:14:10 +0530 mailte Penchalaiah P. folgendes:
> 4) The following is the function that retrieves the records from pss :
>
> 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';
Your loop is wrong, for i in 1..3 select... and then returns the first
record.
Change this to:
BEGIN
..
for rowdata in select * from pss ;
return next rowdata ;
end loop;
..
END;
*untestet*
HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===
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: andreas.kretschmer@schollglas.com
Subject: Re: set return function is returning a single record, multiple times, how can i get all the records in the table( description inside )
In-Reply-To: <20060428105621.GD8542@webserv.wug-glas.de>
* 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