Below is a batch file that I used to use, to quickly and easily create tab delimited files from tables, views, or even queries using Toad v8.1. The batch file creates an export specification file using the table/view name, then logs into Toad using the “EXP=” command-line switch to export the data. I got a lot of use out of this batch file; I had alternate versions for .CSV comma-delimited files and for .XLS Excel files.
Unfortunately, we recently upgraded from v8.1 to v12.x and the “EXP=” command line switch is no longer available. Now there doesn’t seem to be any way to duplicate this functionality. I looked at using an “action” with the -a switch, but the “Automation Designer” doesn’t seem to allow any way to pass in a table name. This means we need to create a separate action, using a lot of pointing-and-clicking, anytime we have a new table to export.
I don’t understand why the EXP= switch was discontinued, especially if the functionality it provided is not available any other way. Please tell me I am wrong, or I’m missing something? If not, I wish you would bring EXP= back.
toad_tab_export.bat:
echo off
if not %5.==. goto :start
echo. Usage:
echo. %~n0 [schema] [password] [instance] [table] [output_file] [[quotes]]
pause
goto :EOF
:start
set toad_exe=“C:\Program Files\Quest Software\Toad for Oracle\TOAD.exe”
if exist temp_toad_export_spec_file.txt del temp_toad_export_spec_file.txt
if exist temp_toad_export_spec_file.txt echo Error: Couldn’t delete existing file temp_toad_export_spec_file.txt&goto :EOF
echo FORMAT=DELIM >temp_toad_export_spec_file.txt
echo DELIMINT=9 >>temp_toad_export_spec_file.txt
echo CELLBORDERS=NO >>temp_toad_export_spec_file.txt
echo DELIMAFTERROW=NO >>temp_toad_export_spec_file.txt
echo COMMIT=0 >>temp_toad_export_spec_file.txt
echo QUOTES=%6 >>temp_toad_export_spec_file.txt
echo COLUMNS=YES >>temp_toad_export_spec_file.txt
echo LOWERCASECOLUMNS=NO >>temp_toad_export_spec_file.txt
echo NULLS=NO >>temp_toad_export_spec_file.txt
echo COMPRESS=NO >>temp_toad_export_spec_file.txt
echo UNIXFORMAT=NO >>temp_toad_export_spec_file.txt
echo INCSQL=NO >>temp_toad_export_spec_file.txt
echo NOWRAP=NO >>temp_toad_export_spec_file.txt
echo OUTPUTDIR=%CD%\ >>temp_toad_export_spec_file.txt
echo BEGINQRY %CD%%5 >>temp_toad_export_spec_file.txt
echo SELECT * FROM %4 >>temp_toad_export_spec_file.txt
echo ENDQRY >>temp_toad_export_spec_file.txt
echo CLOSETOAD >>temp_toad_export_spec_file.txt
start /wait “Toad Export” %toad_exe% connect=%1/%2@%3 EXP=temp_toad_export_spec_file.txt
Regards,
-Tom Warfield