実行計画採取 その2

/* 1行に表示するバイト数の設定 */
set linesize 1000

/* 1ページの行数 */
set pagesize 0

/* 列ヘッダを非表示 */
set heading off

/* SPOOL出力開始 */
spool hogehoge.log

/* 開始日時表示 */
select to_char(sysdate, 'yyyy-MM-dd HH:mm:ss') from dual;

/* 実行計画と実行統計の結果表示サイズ設定 */
column PLAN_PLUS_EXP format a200

/* 実行計画と実行統計の採取 開始 */
set autotrace traceonly

/* SQL */
variable TNAME varchar2(10);
execute :TNAME := 'hogehoge';
select * from user_tab_columns where table_name = 'dual';

/* 実行計画と実行統計の採取 終了 */
set autotrace off

/* 終了日時表示 */
select to_char(sysdate, 'yyyy-MM-dd HH:mm:ss') from dual;

/* SPOOL出力終了 */
spool off