Re: How can I run Toad from VBScript

From: its not me <it.is_at_not.me.com>
Date: Mon, 09 Oct 2006 22:53:41 +0100
Message-ID: <vvfli29jc38m74ksqque09v2vv81vnpu5u_at_4ax.com>


IMHO I would think that using a PLSQL procedure & outputing to a file (.CSV) would be a simpler solution.

Alternately you can ODBC from Excel into an oracle database easily.

I have however found that for the purpose of batch jobs a procedure works best.

declare

    hFile utl_file.file_type;
    sOutPut varchar2(2000);
begin

    hFile := utl_file.fopen('directoryName','fileName.csv','W');     for r in myView
    loop
      sOutPut := to_char(r.col1_dt,'dd-Mon-yyyy') || ',' || r.col2_num ||',"'|| r.col3_txt ||'"';

      utl_file.put_line(hFile,sOutPut);
    end loop;
    utl_file.fclose(hFile);
end;

would create a file something like:
01-Jan-2006,123,"Fred"
01-Jan-2006,221,"Lou"
...

this would be saved in the file fileName.csv inside the directory directoryName.
Depending on the version of your database you may need to set the UTL_FILE_DIR or use the CREATE DIRECTORY feature. There are some o/s differences as well so consult your manual.

On 6 Oct 2006 08:59:43 -0700, "RN" <rlntemp-newsgroup_at_yahoo.com> wrote:

>Re: Oracle 9i / Toad 8.6
>
>I have a situation where I need to launch Toad within a Batch
>environment to run 5 separate SQL scripts and export the data from
>these five scripts to five separate Excel Files.
>Example:
>"Toad.exe","MySqlScript_1.SQL","MySql_1_Exported Data.XLS"
>"Toad.exe","MySqlScript_2.SQL","MySql_2_Exported Data.XLS"
>"Toad.exe","MySqlScript_3.SQL","MySql_3_Exported Data.XLS"
>"Toad.exe","MySqlScript_4.SQL","MySql_4_Exported Data.XLS"
>"Toad.exe","MySqlScript_5.SQL","MySql_5_Exported Data.XLS"
>
>Does anyone have an example where they launched Toad in a 'batch mode'
>to run multiple scripts?
>I am hitting brick walls in trying to do this.
>
>I would welcome your examples/suggestions.
>
>Thanks.
Received on Mon Oct 09 2006 - 23:53:41 CEST

Original text of this message