Home » SQL & PL/SQL » Client Tools » executer script from toad
executer script from toad [message #323535] Wed, 28 May 2008 12:41 Go to next message
shoaib123
Messages: 118
Registered: December 2007
Location: Chicago
Senior Member

Hi,

I am really new in Toad. Please help somebody on my this dummy question.
i have a script sitting in some directiry like
C:\scrtip\a.txt.

i need to execute this sql script file from toad using something like this..

exec C:\script\a.txt

but it is giving me an error. can u make correction of this commnd line syntax.

I appreciate for any help on this.

thanks for you valuable time.
Re: executer script from toad [message #323538 is a reply to message #323535] Wed, 28 May 2008 12:53 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
The menu locations depend on your version. In my 9.6, I do this to run my script in SQLplus. (Toad has it's own script runner that I've never used).

In options, under executables, select path to sqlplus.

From a sql window, enter "@C:\script\a.txt"

Editor > Execute SQL via SQL*plus.
Re: executer script from toad [message #323541 is a reply to message #323535] Wed, 28 May 2008 13:23 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
shoaib123 wrote on Wed, 28 May 2008 13:41

I am really new in Toad. Please help somebody on my this dummy question.
i have a script sitting in some directiry like
C:\scrtip\a.txt.

i need to execute this sql script file from toad using something like this..

exec C:\script\a.txt

but it is giving me an error. can u make correction of this commnd line syntax.



I don't see any error, so I am going to make an assumption. The name of the directory in the EXEC command is different than the actual directory name (scrtip vs. script). File or Directory not found.
Re: executer script from toad [message #323542 is a reply to message #323535] Wed, 28 May 2008 13:31 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12022.htm#sthref2263

from above
EXEC[UTE] statement
where statement represents a PL/SQL statement.

Please NOTE that EXEC is used to invoke PL/SQL & NOT vanilla SQL

SQL<>PL/SQL
Re: executer script from toad [message #323543 is a reply to message #323541] Wed, 28 May 2008 13:37 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
exec is a sqlplus command that gets converter to begin end;

So:

exec C:\script\a.txt


essentially gets converted to:

begin
  C:\script\a.txt
end;

which is invalid pl/sql.


To run a sql file from sqlplus, "start", "@" and "@@" are the most commonly used. "@@" isn't really appropriate here.
start C:\script\a.txt
@C:\script\a.txt
@@C:\script\a.txt



Previous Topic: Access Discoverer Tables using SQL Developer
Next Topic: how to import data stored in MS-Access to Oracle?
Goto Forum:
  


Current Time: Fri Dec 02 16:59:58 CST 2016

Total time taken to generate the page: 0.32913 seconds