Batch file for Toad

Hi Team,
I have updated my Toad for Oracle from Version 9.7.1 to 13.1.0.78 and now the batch file is not working.

I created a batch file to run a .sql file using older version of Toad(Version 9.7.1). We updated the toad to latest version (Version 13.1.0.78) but now the batch file is not able to execute the .sql file. I changed the URL so that it refer to new toad.exe file, batch file is able to open the sql file but unable to run it.

Below is the code

echo start cls

C:

cd C:\Program Files (x86)\Quest Software\Toad for Oracle 13.1\ %systemroot%\Syswow64\cmd.exe /K Toad.exe -c USER_ID/Password@Database -f "C:\working\Automation\Batch_Files\TPR_Code_SCDM_Auto.sql" /exec

PROMPT TABLES UPDATED

GOTO:EOF EXIT /B

:END

-f just loads a file into the editor. Add /EXEC if you want it to execute automatically.

Edit:
Oops! I see you have /exec in there already. Change it to uppercase and it should work.

Also, have a look at Toad's Automation Designer to learn about how to do more things from command line with Toad. It's in the help file, but you can also find out a lot about it by searching this forum.

1 Like

I did tried /EXEC but its not working. The issue is with only Toad for Oracle 13.1. Older version is working fine

Could it be because I have 2 versions of Toad installed on my computer ?

I verified that /EXEC works in 13.1, but only if you write it in UPPERCASE. You have it in lowercase in your command above.

I fixed that for 13.2.

Could it be because I have 2 versions of Toad installed on my computer ?

No, I have more than that.

I tried /EXEC but its only starting the toad and loads file into editor. Not able to execute.

Oops, sorry, I must have tested with 13.2 before and not 13.1
I can reproduce the problem even with uppercase in 13.1.
In the meantime, if you don't mind running your command as script, then this works:

toad.exe -c user/pass@db -f "C:\YourScript.sql" /SCRIPT

If it needs to happen in the same session as main Toad connection, go to Options -> Oracle -> Transactions, then make sure "Execute scripts in Toad Session" is checked.

I'll look into 13.1 EXEC and see if I can find the problem there. WIll get back to you on that.

1 Like

Well, it is definitely broken in 13.1, and I don't think there is anything you can do to make it work.

So your workarounds are:

  1. Use /SCRIPT instead of /EXEC
  2. Download the 13.2 beta and use that instead.

If you can use the beta, please do. The nice thing about that is if you find a problem, we can usually have a fix for you in a day or two. I'd really like to see a lot more beta users. It's good for you, and good for Toad.

You can get the beta here:

1 Like

/SCRIPT works. Thank you so much. Thanks a lot.

Now it is perfectly getting executed as script but after that , I am not able to exit toad.

None of the below code works

PROMPT TABLES UPDATED

GOTO:EOF
EXIT /B

:END

I tried EXIT and EXIT /B but it does not work and when I close it manually, it again give prompts that ask Commit or Rollback.

Also could you suggest me some material, website to learn toad as a developer ???

it again give prompts that ask Commit or Rollback.

Add a commit at the end of your script and I think the prompt will go away.

If your goal is to just run some SQL and then exit Toad, you really should use the automation designer. It will really simplify your batch file, and you won't need EXIT or EXIT /B anymore.

I made a video of how to set it up and how to run it. I forgot to show in the video that you need to have the "save passwords" option in the login screen turned on.

As for learing materials, here are a few quick suggestions:

  1. Videos on Toadworld https://blog.toadworld.com/tag/toad-for-oracle-videos
  2. https://support.quest.com/toad-for-oracle/training
  3. Videos on youtube https://www.youtube.com/results?search_query="toad+for+oracle
1 Like

Thank you so much for all the efforts. Appreciate it alot.

Thanks for the solution... helped my code too