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!

what is slash / for?

Status
Not open for further replies.

voodoojon

Technical User
Dec 18, 2003
107
0
0
GB
I've seen lots of scripts with the / character on its own line, but I can't find documentation on the internet to tell me what it's for. What's it for?

thanks

Jon

One day I will find a signature worthy of this space. That day has not yet come.
 
Jon,

To add to Alex's correct response: The slash is a directive that SQL*Plus uses to execute what SQL command resides in the SQL buffer. Outside of SQL*Plus, the functionality of the slash ("/") would depend upon the functionality that that non-SQL*Plus environment defines for a slash. And, as you noted, for the slash to have its prescribed functionality within SQL*Plus, it must be the first character on a line of its own.

If the slash is the second character (or beyond), upon entry into the SQL*Plus buffer, SQL*Plus ignores the character, then upon execution, SQL*Plus throws an error for the slash since it is not the first character on the line.

If the slash is the first character on the line, but it is not followecd immediately by a [carriage-return], then (in versions earlier than Oracle 9) SQL*plus throws a benign diagnostic that says, "...input truncated to n characters.", Where "n" is the total number of characters that reside on the line with the "/".

Also (as you probably already know), SQL*Plus recognises the ";" as a "end of statement...execute now" symbol, which can be anywhere on the command line or on a line of its own.

Note (for emphasis) that both the slash ("/") and the semi-colon (";") acting as directives to execute a SQL command are symbols that SQL*Plus recognises. For those symbols to have similar behaviour in non-SQL*Plus environments, would be functionality of whatever non-SQL*Plus environment that you are using.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
Is a / necessary to execute a begin - end block? I've tried using ; in place of / in this instance, and it didn't seem to work (I'm using oracle 8.0).
 
D,

Yes, a "/" is necessary for PL/SQL (having different rules of symbol syntax), to direct SQL*Plus to interpret and execute the previous block of PL/SQL code.

So, definitively, "/" and ";" are not interchangable in either SQL*Plus or PL/SQL. Although the outcome of using "/" and ";" can look similar in SQL*Plus, SQL*Plus interprets them differently; in PL/SQL, the respective behaviours of "/" and ";" are WAAAAY different.

Let us know if you have additional follow-on questions.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[ Providing low-cost remote Database Admin services]
Click here to join Utah Oracle Users Group on Tek-Tips if you use Oracle in Utah USA.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top