日期:2014-05-17  浏览次数:20976 次

bat文件执行sql脚本
现在我用bat文件执行sql脚本发现会弹出cmd窗口,需要手都输入:/后程序才能执行完,

如果sql脚本文件中仅仅只有insert语句,我用exit就可以---程序执行的时候bat文件闪一下就结束了。

但是我的sql脚本语言中还有过程名称,我只能以begin开始end;结束,这样程序好像就不会自动退出。还必须在cmd执行窗口手动的输入/,程序才能够执行完。

有哪位高手知道怎样让程序自动执行结束?谢谢!



------解决方案--------------------
编辑bat文件,在begin开始end;后面加一个‘/'(重启一行)
------解决方案--------------------
PL/SQL 的END;后面,还有COMMIT;语句后面都要换行加'/'
还有别的什么大家补充哈~
------解决方案--------------------
SQL code

d:\>
d:\>more test.bat
sqlplus aaa/aaa @d:\test.sql

d:\>more test.sql
select * from dual;
INSERT INTO test(a) VALUES(1);

BEGIN
   INSERT INTO test(a) VALUES(2);
END;
/
commit;
exit;

d:\>test.bat

d:\>sqlplus aaa/aaa @d:\test.sql

SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 9月 9 23:03:07 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options


D
-
X


已创建 1 行。


PL/SQL 过程已成功完成。


提交完成。

从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开