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.
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.