X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 03C24D1B50C for ; Wed, 17 Sep 2003 20:47:12 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 94524-10 for ; Wed, 17 Sep 2003 17:46:38 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id 63B53D1B507 for ; Wed, 17 Sep 2003 17:46:36 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id F0C6F2B3D5 for ; Wed, 17 Sep 2003 22:45:54 +0200 (CEST) Message-ID: <3F68C810.6020401@klaster.net> Date: Wed, 17 Sep 2003 22:46:08 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Lista dyskusyjna pgsql-sql Subject: cursors in plpgsql Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/168 X-Sequence-Number: 15146 Hi I wanted to use some select result several times in pl/pgsql function. DECLARE test refcursor; x record; BEGIN open test for select... fetch test into x; while found loop ...work... fetch test into x; end loop; ...rewind cursor using move... fetch test... Neither move backward 10000 in test; nor execute ''move backward 10000 in test''; doesn't work. In first case I get: ERROR: parser: parse error at or near "$1"... In secod: ERROR: unexpected error -5 in EXECUTE of query... I tried also with "perform" - I got no error, but also no valid result. What should I do with it? Or maybe is it possible somehow to use cursor in FOR..IN loop? Regards, Tomasz Myrta