Subscribe to this feed

Navigation

Recent Posts

Archive

Run Multiple SQLPlus Queries via DOS batch file

Saturday 05 May, 2007 - 12:51pm | 4 comments |

To run multiple SQLPlus queries as part of a DOS batch file place all the queries in a separate SQL file. For Example

@C:\Queries\Query_1.sql
@C:\Queries\Query_2.sql
@C:\Queries\Query_3.sql
@C:\Queries\Query_4.sql

Save the file as runall.sql. Then use this file in your batch file

@Echo Off
sqlplus [login details] @C:\queries\runall.sql
EXIT

Posted in: Business
Tags: SQLPlus | bat | DOS | Oracle

Comment
 | Link | back to top | del.icio.us digg it furl reddit

..

Thursday 27 Nov, 2008 - 12:18pm

you can try this under Unix it works :

echo exit | sqlplus .... @my.file.sql

Posted by: Anonymous

.. EXIT

Tuesday 07 Oct, 2008 - 08:17am
ADD EXIT AFTER ALL THE @...SQL FILES HAVE BEEN LISTED IN RUNALL.SQL FILE.

Posted by: Anonymous

.. Hmmmmm

Wednesday 09 Jan, 2008 - 00:48am
Hmmmm -I've used this commercially without problem. Individual queries cycle through until complete, the only exit I invoke is at the end of the combined SQL file to close the SQL*Plus window and allow the batch file to continue with any other commands such as file moving, renaming etc etc. It really has been that simple..... Otherwise you will be exiting SQL*Plus after each query has executed, you will then need to log back into it again for each query to run. Once you open SQL*Plus it will keep looping through your queries until it comes to an end. One SQL query finishes, another begins. You don't need to exit and then log back in again for that to happen. You only need to do that at the end.

Posted by: ZorbaTheGeek

.. not that simple

Tuesday 08 Jan, 2008 - 22:31pm
You also need to ensure that each sql script being called has an exit statement, else the batch file halts waiting for user intervention....

Posted by: Anonymous


© Eriginal Ltd 2011, all rights reserved