简体   繁体   English

如何自动打开文件 - PL/SQL(Oracle SQL Developer)

[英]How to open file automaticalty - PL/SQL(Oracle SQL Developer)

I am writing using the spool command to a file and I would like when I finish writing and use the spool off command that the file opens automatically for the user.我正在使用 spool 命令写入文件,当我完成写入并使用 spool off 命令时,我希望该文件为用户自动打开。

How can I open the file automatically with PL/SQL?如何使用 PL/SQL 自动打开文件?

Thank you!谢谢!

SQL*Plus, SQL Developer and SQLCl have a special command HOST for such things: SQL*Plus、SQL Developer 和 SQLCl 有一个特殊的命令HOST来处理这些事情:

So you can add a command host with open on Linux/Unix and start on Windows.因此,您可以添加一个在 Linux/Unix 上open并在 Windows 上start的命令host For example, I define a substitution variable _START in my glogin script:例如,我在我的glogin脚本中定义了一个替换变量_START

and then use it as host &_START &spoolfile , for example in my script sqlid_exec_html.sql for RTSM reports:然后将其用作host &_START &spoolfile ,例如在我的 RTSM 报告脚本sqlid_exec_html.sql中:

spool &MON_FILE

SELECT
    DBMS_SQLTUNE.REPORT_SQL_MONITOR( 
       SQL_ID       => '&MON_SQLID',
       sql_exec_id  => '&MON_SQLEXEC',
       report_level => 'ALL',
       type         => 'ACTIVE') as report   
FROM dual
/
spool off
host &_START &MON_FILE

But sometimes (if shell/terminal supports your file extension), you can just type host &spoolfilename .但有时(如果外壳/终端支持您的文件扩展名),您只需键入host &spoolfilename

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM