简体   繁体   English

在bat文件中运行sql脚本,该bat文件将调用其他3个sql脚本

[英]Running a sql script inside a bat file which calls 3 other sql scripts

I am trying to run the below command inside a bat file 我正在尝试在bat文件中运行以下命令

echo exit | sqlplus -S TEST_VKR/vkr@Oracle C:\users\vkr\scripts\Master.sql > Output.txt

The Master.sql has the following content Master.sql具有以下内容

@@ 01_Script.sql;
@@ 02_Script.sql;
@@ 03_Script.sql;
@@ 04_Script.sql;

These scripts when run individually inside the Master.sql returns no error. 这些脚本在Master.sql中单独运行时,不会返回错误。 Having just the first 3 script files in the Master.sql returns no error. Master.sql中只有前3个脚本文件不会返回任何错误。 When all of the 4 scripts are run together in the Master.sql I suspect an overlap between 03 and 04 which is causing the error. 当在Master.sql中同时运行所有4个脚本时,我怀疑03和04之间存在重叠,这会导致错误。

Is there a way to add a wait step between the sql scripts inside the Master.sql file? 是否可以在Master.sql文件中的sql脚本之间添加等待步骤?

for %a in (0?_Script.sql) do sqlplus -S TEST_VKR/vkr@Oracle %a>>Output.txt

or 要么

for /l %a in (1,1,4) do sqlplus -S TEST_VKR/vkr@Oracle 0%a_Script.sql>>Output.txt

note: Double the % in a batch file ( %a to %%a ) and put echo in front of sqlplus to test the command before applies. 注意:双倍%batch file%a%%a ),并把回声在sqlplus前测试应用前的命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM