Windows批处理文件的SQLPLUS命令行 [英] SQLPLUS command line with Windows batch file

查看:267
本文介绍了Windows批处理文件的SQLPLUS命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个批处理文件,该文件将打开SQLPLUS [CLI],将执行一些存储的sql文件,还将输出存储到文本文件中.

I want to create a batch file which will open the SQLPLUS [CLI] and will execute some stored sql file and will also store the output to text file.

因此,我创建了此批处理文件[不起作用].
这些SQL文件包含返回表中最大数目的SQL.

So I've created this batch file [which does not work].
These SQL file contains SQL which returns the max number from a table.

sqlplus scott/tiger@DB
@sql1.sql>data1.txt
@sql2.sql>data2.txt

问题是打开SQLPLUS后不能执行SQL文件

The problem is it does not executes the SQL files after opening the SQLPLUS

  • Windows XP
  • Oracle 9i

推荐答案

本机Sql * plus假脱机如何处理?

What about native Sql*plus spooling?

run.bat:

sqlplus hr/hr@sandbox @d:\run.sql

run.sql:

spool d:\run.log
set echo on 

select * from dual
/
exit

run.log:

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

这篇关于Windows批处理文件的SQLPLUS命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆