Toad World® Forums

Help to include file in Toad editor

Hi, and thanks for your help.

I must write a huge sql cript. I plan to split this script into several files.
I won’t open, and call every files manually (this script will be called often). Then I would like to create a general script, using toad, calling each file.

Exemple :

I open my main script manually in toad editor.
It looks like :

– insert customers in database
include_and_exec “c:\my_insert_statments.sql”

– insert orders
include_and_exec “c:\my_insert_orders.sql”

… and so on.

But is there an instruction to include and exec statements store in a external file?
Any idea?

Cyril

On Thu, 23 Jun 2011 09:30:13 PDT
CyrilH wrote:

Message from: Cyril

Hi, and thanks for your help.

I must write a huge sql cript. I plan to split this script into
several files. I won’t open, and call every files manually (this
script will be called often). Then I would like to create a general
script, using toad, calling each file.

Exemple :

I open my main script manually in toad editor.
It looks like :

– insert customers in database
include_and_exec “c:\my_insert_statments.sql”

– insert orders
include_and_exec “c:\my_insert_orders.sql”

… and so on.

But is there an instruction to include and exec statements store in a
external file? Any idea?

Cyril


Historical Messages

Author: CyrilH
Date: Thu Jun 23 09:30:13 PDT 2011
Hi, and thanks for your help.

I must write a huge sql cript. I plan to split this script into
several files. I won’t open, and call every files manually (this
script will be called often). Then I would like to create a general
script, using toad, calling each file.

Exemple :

I open my main script manually in toad editor.
It looks like :

– insert customers in database
include_and_exec “c:\my_insert_statments.sql”

– insert orders
include_and_exec “c:\my_insert_orders.sql”

… and so on.

But is there an instruction to include and exec statements store in a
external file? Any idea?

@full_path_to_file.sql

or

@@look_for_file_in_same_directory_as_this_file_is_located.sql

example:

@c:\file1.sql
@c:\file2.sql

will run file1 and then file2. Toad will look for these files in c:
and will show an error if it can’t find them.

Exxample:

@@file3.sql
@@file4.sql

will run file3 and file4. Toad will look for these files in the
“current dirctory” which will be the saved file (the one that contains
the @@commands)'s directory or toad’s default directory if the editor
isn’t of a saved file.

It perfectly works.

Thank you Jospeh.