Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about syntax 2

Status
Not open for further replies.

cwsstins

MIS
Aug 10, 2004
412
0
0
US
Working with Oracle SQL*Plus to make updates to numerous tables. I have a script that I'm developing in Notepad. There are numerous UPDATE commands and I'm wondering, should I put a semi-colon at the end of each command or just at the end of the entire script?
 
SQL statements in a SQL*Plus script must each be followed by a semi-colon.

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: Emu Products Plus
 
Actually you may also put a slash / on the next line. Moreover, some older versions of sql*plus support only this method.

Regards, Dima
 
What's the difference between using the ; or the /? I know that a / as a command on its own will run the last command, but how does it work to signify the end of a command?
 
Statements inside a PL/SQL script need the semi-colon.
Code:
begin
update table1 set ...[COLOR=red];[/color]
update table2 set ...[COLOR=red];[/color]
end;
The / runs a script:
Code:
select * from dual
/

[sup]Beware of false knowledge; it is more dangerous than ignorance.[/sup][sup] ~George Bernard Shaw[/sup]
Consultant Developer/Analyst Oracle, Forms, Reports & PL/SQL (Windows)
My website: Emu Products Plus
 
OK, I'm running into an issue trying to run my script. I've created the script in Notepad...saved it as a .sql. Now I open it in SQL*Plus (File >> Open...) and it lists the contents of the script, but it seems to be truncating data as it runs off the right hand side of the screen. Tried increasing the buffer width through the Environment menu....doesn't seem to help. Am I going to need to insert carriage returns via the Notepad editor?

Components of the script (even those that are "running over past the right hand side of the screen") run fine when I copy and paste them into the program. It just won't run the whole script...
 
Do you need to run it or display it?
To launch it you may type @<script file name>, where <script file name> denotes script file name with full path. The path may be ommited in case it's listed in SQL_PATH environment variable or that file is in current directory.


Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top