Toad World® Forums

No more EXP= in command-line; quick and easy export is gone?

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

just to understand…

you are saying that command doesn’t work on the same database and only change is Toad 8.1->12.x?

Or you have also changed database as well (are you using maybe 12c database)?

Brg

Damir

Same database, just changed Toad version.

I am talking about the EXP= command line switch that used to be available in TOAD.EXE - not to be confused with Oracle EXP utility.

-TW

Most action types have a way to specify a parameter file for things like this, but I see that parameter files are not supported for export dataset. This was an oversight and I just added it for the next beta.

So, when the next beta comes out, you can right-click on an action and choose “create parameter file”. Then you can edit that file and run the action using that file. To run the action from command prompt, using the parameter file, the command would look something like this:

toad.exe -a “App->Export Dataset1 | c:\Export Dataset1.ini”

That is fantastic news, thank you very much - I’ll look out for the next version.

-TW