Home » Other » Client Tools » how to execute a .sql file in sqlplus
how to execute a .sql file in sqlplus [message #262065] Fri, 24 August 2007 07:38 Go to next message
miroconnect@yahoo.com
Messages: 202
Registered: April 2006
Senior Member
I want to execute a script file in sql-plus,
my script -file is located in C:/build/project/database/test-script.sql

to run this I am using
@C:/build/project/database/test-script.sql
am I doing it right because after I type the above command and press enter nothing happens ?

Re: how to execute a .sql file in sqlplus [message #262068 is a reply to message #262065] Fri, 24 August 2007 07:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes this is correct.
Maybe the script is waiting for something and you have turn off termout.

Regards
Michel
Re: how to execute a .sql file in sqlplus [message #262069 is a reply to message #262065] Fri, 24 August 2007 07:42 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
I'm going to have to say that there is nothing in the script file, or nothing that produces any output. Since you haven't posted it, that's my assumption.
Re: how to execute a .sql file in sqlplus [message #262071 is a reply to message #262065] Fri, 24 August 2007 07:45 Go to previous messageGo to next message
miroconnect@yahoo.com
Messages: 202
Registered: April 2006
Senior Member
here is my script

SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
SET ESCAPE \
SPOOL test.SQL
select table_name from user_tables

it should produce a file will all user tables .
Re: how to execute a .sql file in sqlplus [message #262072 is a reply to message #262071] Fri, 24 August 2007 07:48 Go to previous messageGo to next message
transfer
Messages: 53
Registered: August 2007
Location: transfer
Member
Try putting a semi-colon -> ; <- at the end of the last line, and if necessary a new empty line underneath.
Re: how to execute a .sql file in sqlplus [message #262077 is a reply to message #262065] Fri, 24 August 2007 07:57 Go to previous messageGo to next message
miroconnect@yahoo.com
Messages: 202
Registered: April 2006
Senior Member
I added semicolon and enter after last line, the script did print all table names but it did not create file called test.sql
and it gave this mesage "SP2-0311: string expected but not found"
what is this and why is it not creating test.sql file ?
Re: how to execute a .sql file in sqlplus [message #262087 is a reply to message #262077] Fri, 24 August 2007 08:07 Go to previous message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
"spool off" is missing.
Until you execute this or quit SQL*Plus the content of the file is not visible.

Regards
Michel

Previous Topic: SQL Navigator err: Can't initialize OCI. Error -1
Next Topic: suing sqlplus from command line
Goto Forum:
  


Current Time: Thu Mar 28 05:08:49 CDT 2024