If you have a batch file set to run multiple SQLPlus queries and to then perform some other action such as merge the results together into a single file, or copy the files elsewhere you need to physically exit SQLPlus or the batch file will not continue to run and execute the commands.
To exit SQLPlus automatically skip a line after your last query and type exit as in
To run multiple SQLPlus queries as part of a DOS batch file place all the queries in a separate SQL file. For Example
Save the file as runall.sql. Then use this file in your batch file
You can use the result of a SQLPlus query as a variable in a windows batch file by spooling the output to a .bat file
This creates or replaces a batch file and outputs
I am then able to call that batch file from within another batch file and use the SQL query result as it is defined as a variable.
© Eriginal Ltd 2011, all rights reserved