X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D111311F605A for ; Fri, 28 Apr 2006 07:56:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 41777-03 for ; Fri, 28 Apr 2006 07:56:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by postgresql.org (Postfix) with ESMTP id 6002B11F602E for ; Fri, 28 Apr 2006 07:56:23 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2Dk-1FZQe61kbY-0000jl; Fri, 28 Apr 2006 12:56:22 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1FZQe5-00056s-00 for pgsql-sql@postgresql.org; Fri, 28 Apr 2006 12:56:21 +0200 Date: Fri, 28 Apr 2006 12:56:21 +0200 From: "A. Kretschmer" 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 ) Message-ID: <20060428105621.GD8542@webserv.wug-glas.de> Mail-Followup-To: "A. Kretschmer" , pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-DEST: 208 X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/199 X-Sequence-Number: 25008 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 ===