如果我有3个SQL脚本,并且如果我在第一个sql脚本中输出假脱机& 1,我必须在假脱机程序中输出第二个sql脚本输出& 2 ..我试图获取所有那些输出在另一cshell脚本..可有人给我解释一下如何做滑& 1作品Oracle SQL脚本假脱机&1
0
A
回答
1
&1
是位置参数。使用spool &1
装置的输出会去,你在通过在命令行上的第一个参数的文件名
如果您的CSH脚本调用三个SQL脚本,它们都含有线轴,他们应该每个参考&1
,第二个不使用&2
。 (只要文件名是每种情况下的第一个参数)。对于每个SQL * Plus会话,“计数器”重置为1。所以,如果你调用QUERY1.SQL,query2.sql和query3.sql SQL脚本,您的CSH脚本可能看起来像:
#!/bin/csh
sqlplus -s/@query1 output_file_1
sqlplus -s/@query2 output_file_2
sqlplus -s/@query3 output_file_3
每个SQL脚本将包含spool &1
,输出会去到不同的文件。然后你可以在你想要的同一个csh脚本的其他地方引用输出文件。
正如Robert在他引用的文档中提到的,如果您希望所有输出都转到同一个文件,您需要将相同的文件名传递给全部三个sqlplus
命令,并使第二个和第三个spool命令具有APP[END]
参数。
1
Asuming你有版本10g或更高版本,你有以下几种选择:
SQL> spool name_of_file
SQL> spool name_of_file off
SQL> spool name_of_file out
SQL> spool name_of_file create
SQL> spool name_of_file append
SQL> spool name_of_file replace
不要小看预言罚款在线的力量文档:
CRE[ATE]
Creates a new file with the name specified.
REP[LACE]
Replaces the contents of an existing file. If the file does not exist, REPLACE creates the
file. This is the default behavior.
APP[END]
Adds the contents of the buffer to the end of the file you specify.
OFF
Stops spooling.
OUT
Stops spooling and sends the file to your computer's standard (default) printer. This
option is not available on some operating systems.
Enter SPOOL with no clauses to list the current spooling status
相关问题
- 1. Oracle假脱机脚本输出到表
- 2. Oracle SQL脚本中基于条件的假脱机生成
- 3. 如何创建一个oracle sql脚本假脱机文件
- 4. Oracle Unicode假脱机
- 5. Oracle SQL自动并行假脱机
- 6. Oracle SQL Developer - 假脱机错误
- 7. Oracle假脱机位置
- 8. Oracle假脱机设置
- 9. 动态打开SQL plus假脱机文件(假脱机之前)
- 10. 如何在Oracle中正常假脱机
- 11. 在Oracle 11g中使用假脱机
- 12. 停止假脱机打印使用的SQL查询(Oracle)的
- 13. Oracle sql脚本
- 14. 优化sql查询以摆脱假脱机空间问题
- 15. 假脱机CLOB的数据
- 16. 假脱机多个文件
- 17. 避免在Oracle SQL中假脱机时复制到CSV中的错误
- 18. 使用Oracle查询假脱机文件中的特定记录
- 19. 当假脱机到文件时Oracle查询输出不完整
- 20. 在从oracle表中假脱机过程中压缩数据
- 21. 获取中间假脱机输出
- 22. 打印机假脱机程序api的副本数
- 23. 区别:本机和非本机Oracle SQL?
- 24. 假脱机文本文件内容意外打包
- 25. oracle sql plus脚本太长
- 26. 只在脱机时执行php脚本
- 27. 用于DB2的脱机备份脚本
- 28. 在SQL Server上避免急于假脱机操作的方法
- 29. SQL索引假脱机(eager spool)加速查询
- 30. 在sql开发人员不工作的插入假脱机
谢谢..它帮助了很多 – jack 2011-03-24 16:40:06