main.sql:設定環境、呼叫功能腳本get_tables.sql:實際查詢邏輯set linesize 200
set term off verify off feedback off pagesize 999
set markup html on entmap ON spool on preformat off
spool tables.xls
@get_tables.sql
spool off
exit
select owner, table_name, tablespace_name, blocks, last_analyzed
from all_tables order by 1,2;
sqlplus "/ as sysdba" @main
ls -l tables.xls
# -rw-r--r-- 1 oracle dba 69539 Apr 25 10:30 tables.xls
將 spool tables.xls 改為 spool tables.htm 即可產出 HTML 格式。兩種格式輸出效果圖如下:

