
Result from that SQL session is passed to XXX environment variable. bat is initially executing SQL*Plus by calling define_date_value.sql script. "C:\Program Files\Dell\Toad for Oracle 2016 R2 Suite\Toad for Oracle 12.10\Froggy1210.exe" -a "Do_Export | C:\Temp\Do_Export.ini"
Create windows bat file call_export.bat, which will be starter of action with content:įOR /F %%i IN ('sqlplus -s DO set XXX=%%i. Select to_char(sysdate,'mm_yyyy') from dual
SET SERVEROUTPUT ON SIZE unlimited format wrapped I will name it define_date_value.sql, which in fact looks very simple:
Save file it in same directory as this file should be create it's export (for easy control). Right click on chosen App ( Do_Export) and use Create Parameter file option. In this way you are telling Toad to use global environment variable which will hold dynamic value (in our case "mm_yyyy" of some date value) for export file name. In File definition place resulting destination file, which was the main problem, because it must have value derived from sql command. Inside SQL part, place your statement for export, define export type (in mine case Delimited Text). bat file which will initialize environment variable and then call Automation designer, through it's command line interface. And this was a reason, why no one answered to poster.īecause we cannot stay only inside Toad, solution is done in two parts: Reason is that Toad has nowhere exposed application interface for defining such an action. how do I format this in the variable so that it recognizes it as a formula rather than text?Įven thought Toad has made some nice features in variables manipulation, what user wanted, define variable through Sql*Plus commands, is not so clear and obvious how to do it. When I try to define my variable as select to_char(sysdate,'mmm yyyy') from dual it puts that statement in the file name rather than the result of the statement. I'm trying to export a file with a variable name by using the user defined variables in options.