隐藏假脱机文件中的 SQL > 语句
Hide SQL > statements in the spool file
我想在文件 test.txt(假脱机文件)
中隐藏 "SQL> @test.sql" 和 "SQL> spool off"
我的脚步
set heading off
set pages 0
set trimspool on
set lines 120
set feedback off
set echo off
set termout off
spool test.txt
@test.sql
spool off
test.txt
SQL> @test.sql
2002452199 2797 9/1/2014 9/30/2014 OO56128665 934 90087318 1 6046
10226342 ########## 0 0
SQL> spool off
将 sql 语句纳入结果的原因是:-
如果你复制那些sql脚本并直接粘贴到sql提示符处,直接执行就会出现这样的问题。因此,为避免这种情况,将所有脚本代码放入一个 .sql 文件中,并通过在 "sql command prompt" 或 "Dos prompt by logging into sql from Dos" 中提供 @filename.sql 来执行整个文件。
要避免上述issue/problem,请执行以下步骤:-
-------------这是我的spool_test.sql文件代码-------------
SET echo off
SET feedback off
SET term off
SET pagesize 0
SET linesize 200
SET newpage 0
SET space 0
col name format a120
spool C:\test.txt
@D:\mahesh-plsql-books\spool\test.sql
SPOOL OFF
1) 如果您在 SQL> 提示符下执行上述 .sql 文件,则它不会在您的 "test.txt" 中显示 sql 语句和结果.喜欢-->
SQL> @D:\mahesh-plsql-books\spool\spool_test2.sql
2) 在 "test.txt" 的结果中避免 "SQL Statements" 的另一种方法是在 Dos 命令提示符 (c:>) 中执行上述 .sql 文件"sql prompt" 如下图所示--->
C:\>sqlplus scott/tiger @D:\mahesh-plsql-books\spool\spool_test.sql
......那么你的 "test.txt" 不显示 sql 语句,以及 @test.sql.
注意:- scott/tiger 是我的神谕 username/password
感谢和问候,
V.Maheswara拉朱。
此示例脚本 (test.sql):
set heading off verify off feedback off echo off term off pagesize 0 linesize 10000 trimout on trimspool on timing off
spool test.log
SELECT 'content of spool file' FROM dual;
spool off
当 运行:
>sqlplus scott/tiger
SQL*Plus: Release 12.1.0.1.0 Production on Mon Jun 22 08:46:58 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Mon Jun 22 2015 08:46:52 +02:00
Connected to:
Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
SQL> @test.sql
SQL> exit
Disconnected from Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
生成一个 "clean" 假脱机文件:
>type test.log
content of spool file
我想在文件 test.txt(假脱机文件)
中隐藏 "SQL> @test.sql" 和 "SQL> spool off"我的脚步
set heading off
set pages 0
set trimspool on
set lines 120
set feedback off
set echo off
set termout off
spool test.txt
@test.sql
spool off
test.txt
SQL> @test.sql
2002452199 2797 9/1/2014 9/30/2014 OO56128665 934 90087318 1 6046
10226342 ########## 0 0
SQL> spool off
将 sql 语句纳入结果的原因是:-
如果你复制那些sql脚本并直接粘贴到sql提示符处,直接执行就会出现这样的问题。因此,为避免这种情况,将所有脚本代码放入一个 .sql 文件中,并通过在 "sql command prompt" 或 "Dos prompt by logging into sql from Dos" 中提供 @filename.sql 来执行整个文件。
要避免上述issue/problem,请执行以下步骤:-
-------------这是我的spool_test.sql文件代码-------------
SET echo off
SET feedback off
SET term off
SET pagesize 0
SET linesize 200
SET newpage 0
SET space 0
col name format a120
spool C:\test.txt
@D:\mahesh-plsql-books\spool\test.sql
SPOOL OFF
1) 如果您在 SQL> 提示符下执行上述 .sql 文件,则它不会在您的 "test.txt" 中显示 sql 语句和结果.喜欢-->
SQL> @D:\mahesh-plsql-books\spool\spool_test2.sql
2) 在 "test.txt" 的结果中避免 "SQL Statements" 的另一种方法是在 Dos 命令提示符 (c:>) 中执行上述 .sql 文件"sql prompt" 如下图所示--->
C:\>sqlplus scott/tiger @D:\mahesh-plsql-books\spool\spool_test.sql
......那么你的 "test.txt" 不显示 sql 语句,以及 @test.sql.
注意:- scott/tiger 是我的神谕 username/password
感谢和问候,
V.Maheswara拉朱。
此示例脚本 (test.sql):
set heading off verify off feedback off echo off term off pagesize 0 linesize 10000 trimout on trimspool on timing off
spool test.log
SELECT 'content of spool file' FROM dual;
spool off
当 运行:
>sqlplus scott/tiger
SQL*Plus: Release 12.1.0.1.0 Production on Mon Jun 22 08:46:58 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Mon Jun 22 2015 08:46:52 +02:00
Connected to:
Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
SQL> @test.sql
SQL> exit
Disconnected from Oracle Database 12c Release 12.1.0.1.0 - 64bit Production
生成一个 "clean" 假脱机文件:
>type test.log
content of spool file