ORACLE: So far nothing I have tried has worked. I wish to display on the screen the results of select * from my_table
. In this case my_table = select table_name from all_tables where owner='ABC' and name like 'ABC%'
. Table name would be a plus, but column name is a necessity. I can do this in seconds with DB2, but can't quite translate for Oracle.
My attempt:
variable refcur refcursor;
declare
my_select varchar2(64);
cursor c_tables is
select table_name
from all_tables
where owner='ABC' and table_name like 'ABC%';
begin
for x in c_tables
loop
dbms_output.put_line(x.table_name);
my_select := 'select * from ' || x.table_name;
open :refcur for my_select;
end loop;
exception
when no_data_found
then dbms_output.put_line('Nothing is found');
end;
/
In all of my attempts, the best I have gotten is table does not exist Thanks