Another question is what you want to do with the table. Often I have seen something like this:
Code:
DECLARE GLOBAL TEMP TABLE t ...;
LOOP ...
INSERT INTO t VALUES (...);
END LOOP;
DECLARE c CURSOR WITH RETURN FOR SELECT * FROM t;
In such a situation, you can often get along by avoid the temp table completely:
Code:
DECLARE c CURSOR WITH RETURN FOR SELECT * FROM TABLE ( VALUES (...), (...), ... ) AS t