For normal SQL statements, either a /
on a line by itself, or a ;
at the end of the command, will work fine.
For statements that include PL/SQL code, such as CREATE FUNCTION
, CREATE PROCEDURE
, CREATE PACKAGE
, CREATE TYPE
, or anonymous blocks (DECLARE
/BEGIN
/END
), a ;
will not execute the command. Since PL/SQL uses semicolons as line terminators, its use as a command terminator must be suppressed in these statements. So in these cases, you must use /
to execute the command.
In my experience, people prefer to use the semicolon when possible and use the slash only when required.
Note that for SQLPlus client commands -- such as SET
or EXECUTE
-- no command terminator is necessary at all, although people often end them with a semicolon out of habit.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…