ORACLE:到目前为止,我所尝试的都没有奏效。我希望在屏幕上显示select * from my_table
. 在这种情况下 my_table = select table_name from all_tables where owner='ABC' and name like 'ABC%'
。表名将是一个加号,但列名是必需的。我可以使用 DB2 在几秒钟内完成此操作,但不能完全转换为 Oracle。
我的尝试:
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;
/
在我所有的尝试中,我得到的最好的结果是表不存在谢谢