Sé que este es un tema antiguo, pero lo acabo de encontrar y siento que no se ha explicado por completo.
Hay una gran diferencia en SQL*Plus entre el significado de un /
y un ;
porque funcionan de manera diferente.
El ;
finaliza una instrucción SQL, mientras que /
ejecuta lo que esté en el "búfer" actual. Así que cuando usas un ;
y un /
la declaración en realidad se ejecuta dos veces.
Puedes ver eso fácilmente usando un /
después de ejecutar una declaración:
SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 18 12:37:20 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning and OLAP options
SQL> drop table foo;
Table dropped.
SQL> /
drop table foo
*
ERROR at line 1:
ORA-00942: table or view does not exist
En este caso, uno realmente nota el error.
Pero asumiendo que hay un script SQL como este:
drop table foo;
/
Y esto se ejecuta desde SQL*Plus, entonces será muy confuso:
SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 18 12:38:05 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning and OLAP options
SQL> @drop
Table dropped.
drop table foo
*
ERROR at line 1:
ORA-00942: table or view does not exist
El /
se requiere principalmente para ejecutar sentencias que tienen ;
incrustado como CREATE PROCEDURE
,CREATE FUNCTION
,CREATE PACKAGE
declaraciones y para cualquier BEGIN...END
bloques.