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