將查詢結果作為需要查詢的表名進行查詢?
set termout off
set feedback off
set trimout on
set trimspool on
set head off
set line 900
spool ./temp.sql
select 'select * from ' || tablename || ';' from table where tableid=1;
spool off
set termout on
set feedback on
set head on
@temp.sql
大體框架就是這樣,呵呵~