windows command shell to run all sqls in a folder for oracle /sqlplus

let say u have a set of sqls to run in a folder(sql1.sql,sql2.sql,sql3.sql bla bla bla..), this script might be useful.

create a batch file(open notepad, save as "runme.bat"), put command below:-

set username=%1
set password=%2
set sid=%3
for %%X in (*.sql) do (
echo exit | sqlplus %username%/%password%@%sid% @%%X
)

serve the parameter to run it in windows command prompt, for example:-

runme.bat mydatabase mypassword mysid

0 comments:

Post a Comment