Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F11A5475B8C for ; Wed, 4 Dec 2002 03:58:37 -0500 (EST) Received: from mailgate5.cinetic.de (mailgate5.cinetic.de [217.72.192.165]) by postgresql.org (Postfix) with ESMTP id BE6AE4759BD for ; Wed, 4 Dec 2002 03:58:36 -0500 (EST) Received: from web.de (fmomail02.dlan.cinetic.de [172.20.1.46]) by mailgate5.cinetic.de (8.11.2/8.11.2/SuSE Linux 8.11.0-0.4) with SMTP id gB48wbX04370 for pgsql-sql@postgresql.org; Wed, 4 Dec 2002 09:58:37 +0100 Date: Wed, 4 Dec 2002 09:58:37 +0100 Message-Id: <200212040858.gB48wbX04370@mailgate5.cinetic.de> MIME-Version: 1.0 Organization: http://freemail.web.de/ From: Stefan Reuschke To: pgsql-sql@postgresql.org Subject: loop query results Precedence: fm-user Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/48 X-Sequence-Number: 10636 With the following function I expected to get an iteration through the results. But the loop seems to be performed two times instead. The function (postgres 7.2): create function echt_char_laenge () returns integer as ' declare char_auslese record; begin for char_auslese in select * from varlaenge loop raise notice ''%, %'', char_auslese.id_var, char_auslese.var_text; end loop; return 0; end; ' language 'plpgsql'; ------------------------------------------------------------ the result: select echt_char_laenge (); NOTICE: 1, text 1X NOTICE: 2, text 2X NOTICE: 3, text 3X NOTICE: 4, text 4X NOTICE: 5, text 5X NOTICE: 6, text 6X NOTICE: 1, text 1X NOTICE: 2, text 2X NOTICE: 3, text 3X NOTICE: 4, text 4X NOTICE: 5, text 5X NOTICE: 6, text 6X echt_char_laenge ------------------ 0 (1 row) ---------- and the result as expected: select * from varlaenge; id_var | var_text --------+------------- 1 | text 1X 2 | text 2X 3 | text 3X 4 | text 4X 5 | text 5X 6 | text 6X (6 rows) Any ideas? Thanx Stefan ______________________________________________________________________________ Schneller als andere! Die Blitz-SMS von WEB.DE FreeMail! http://freemail.web.de/features/?mc=021167