From: Tomasz Myrta <jasiek@klaster.net>
To: Lista dyskusyjna pgsql-sql <pgsql-sql@postgresql.org>
Subject: cursors in plpgsql
Date: Wed, 17 Sep 2003 22:46:08 +0200
Message-ID: <3F68C810.6020401@klaster.net> (raw)
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
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: jasiek@klaster.net
Subject: Re: cursors in plpgsql
In-Reply-To: <3F68C810.6020401@klaster.net>
* 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