EXECUTE IMMEDIATE in plsql
How to get a result from this code EXECUTE IMMEDIATE 'SELECT * FROM ' || table_name through for loop The usual method looks like this for items in (select * from this_table) loop htp.p(items.id); end loop; If you really need to select * from dynamic table name , then I'd probably go with dbms_sql Type for a record : create type tq84_varchar2_tab as table of varchar2(4000); / Type for a result set (which is an array of records ): create type tq84_varchar2_tab_tab as table of tq84_varchar2_tab; / The function that does the select and returns an instance of the result set : create or replace