In a plpgsql procedure I am looking how to reference and use a result set that I get from the first query. Following code tries to demonstrate what I want to achieve:
do
$body$
DECLARE
ref_result_set ???;
BEGIN
ref_result_set := select 'asdf';
perform xxx from ref_result_set;
perform yyy from ref_result_set;
END;
$body$
language plpgsql;
I was looking at cursors but there is just an option to fetch row by row and not an entire set. Is there any option how to achieve this without first writing to a table?