Oracle的Spool命令

來源:互聯網
上載者:User

Oracle的Spool命令

使用Oracle spool命令實行將sql*plus中的輸出的結果複製到一個指定的檔案中,或者把查詢的結果發送到印表機中,直接使用spool off命令為止。

spool命令的文法如下:
spool [file_name [create|replace|append] off|out]

其中file_name指定一個作業系統檔案

create將建立一個指定的file_name檔案
replace如果指定的檔案已經存在,則替換該檔案
append將內容附加到一個已經存在的檔案中
off停止將sql*plus中的輸出結果複製到file_name檔案中,並關閉該檔案。
out啟動該功能,將sql*plus中的輸出結構複製到file_name中。

執行個體如下:

在我的電腦e盤中不存在query.sql檔案

在sql*plus中如下的操作

在我的端腦e盤中找到query.sql檔案,代開該檔案,檔案的內容如下:


該檔案不僅記錄的你查詢的結果的資訊,同時也記錄了你的查詢的語句。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.