我想创建一个批处理文件,它将打开 SQLPLUS [CLI] 并执行一些存储的 sql 文件,并将输出存储到文本文件。
所以我创建了这个批处理文件 [它不起作用]。
这些 SQL 文件包含从表中返回最大数量的 SQL。
sqlplus scott/tiger@DB
@sql1.sql>data1.txt
@sql2.sql>data2.txt
问题是它在打开 SQLPLUS 后不执行 SQL 文件
最佳答案
原生 Sql*plus 假脱机怎么样?
运行.bat:
sqlplus hr/hr@sandbox @d:\run.sql
运行.sql:
spool d:\run.log
set echo on
select * from dual
/
exit
运行日志:
01:50:20 HR@sandbox>
01:50:20 HR@sandbox> select * from dual
01:50:20 2 /
D
-
X
Elapsed: 00:00:00.00
01:50:21 HR@sandbox> exit
关于batch-file - 带有 Windows 批处理文件的 SQLPLUS 命令行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16412040/