I am new to Toad 10.6.1 and have a question about running a SQL script and email data as an excel file on a scheduled basis.
How do I run script and save as excel format and email as excel file to automatically? Thank you for your time.
Below is what I've done so far but dont think its correct as I get "ORA-00911: invalid character" on step #5 .
- Select Utilities | Automation Designer menu option
- Select DB Misc tab from right side pane
- Last icon in this tab is Execute Script, double click on it to add under Action list
- Double click on Execute Script 1 action to open it
- Select Text radio button and enter query statement or File radio button and point to SQL file (I keep getting "ORA-00911: invalid character" as well)
- Under Output pane, designate the Output destination, perhaps a file and if so, provide path and file for output file
- Hit Apply and Cancel
- Right click on Execute Script 1 action and hit Run. Check the above output path and file to ensure its created
- Under utlities I added the email function, but unable to integrate steps 6 & 9 to automate report
When you say "script" are you really trying to export the results of a single query to Excel and then email that? If so, ditch the execute script action. Use the "Export Dataset" action instead which is intended to run a query and export the results to various formats. Execute Script is intended to emulate SQL*Plus functionality and your output is limited to text file.
Drop an "Execute Dataset" action into your app. It's available from the Import/Export tab in Automation Designer.
Double click it to edit its properties.
Select "File" as the output destination and click the "..." button to the right of the filename. Set your filename and choose the .xls file format. Set any other options as you see fit.
Select the Dataset tab and select "Export query." Enter your SQL there.
Apply and Cancel.
Drop an "Email" action into your app following your "Export Dataset" action. It's available from the Utilities tab.
Double click it to edit its properties.
Configure all properties as required for your mail server. *** Note that 10.6 only supports simple mail servers and no SSL/TLS so you can't use your Gmail account or anything like that. It's limiting. Newer versions of Toad support Gmail and the like.
In the Attachments area click "Add File" and specify your exported .xls filename.
Apply and Cancel.
Now when you run your app it will export to XLS and email the file.