Unanswered: Differences between slash '/' and semicolon
I encountered a problem in script the other day where I ended the script with with '; new-line /'. So, I just want to make sure I understand the differences between a slash '/' and a semicolon in PL/SQL.
If I understand it correctly, most of the time these two characters are used interchangably to end a command. However from what I've observed, only semicolons may be used inside of blocks of code that follows a DECLARE...BEGIN...END format.
Am I correctly understanding the differences between these two? Is there a place in the documentation that covers these subtle differences? I tried searching Google and the Oracle PLS/SQL documentation the other day but couldn't find anything pertinenet and thought this is such a basic concept, it must be covered somewhere.
Also, I'm used to adding -- comment lines to the right of code in my PL/SQL scripts, however, this caused a script to not work with SQL+ the other day. When I moved the comment to the next line by itself, everything worked fine. Is this typical?
Semicolon terminates the SQL statement in both SQL*Plus and PL/SQL. However, if the PL/SQL block ends only with semicolon, it won't run as it requires additional slash at the end (behind the last semicolon).
You noticed correctly - it is possible to run multiple SQL statements in SQL*Plus environment ending each of them with either semicolon or slash. PL/SQL will not, as you also noticed, accept slash as statement terminator within the PL/SQL block.
Comments can be added using double minus sign (--) or REM keyword. This is usually used to comment a single line. Multiple comment lines are usually enclosed into /* and */ signs.
Strange behaviour in your script is, well, strange to me. I didn't notice it before. Personally, I prefer adding comments to their own lines instead of right of code lines - it makes them easier to notice and read.