Wiem, że to stary wątek, ale właśnie na niego natknąłem się i czuję, że nie zostało to do końca wyjaśnione.
W SQL*Plus istnieje ogromna różnica między znaczeniem / i ; ponieważ działają inaczej.
; kończy instrukcję SQL, podczas gdy / wykonuje wszystko, co znajduje się w bieżącym "buforze". Więc kiedy używasz ; i / instrukcja jest faktycznie wykonywana dwukrotnie.
Możesz to łatwo zobaczyć za pomocą / po uruchomieniu oświadczenia:
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
W tym przypadku faktycznie zauważa się błąd.
Ale zakładając, że istnieje taki skrypt SQL:
drop table foo;
/
A to jest uruchamiane z poziomu SQL*Plus, więc będzie to bardzo mylące:
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
/ jest wymagane głównie do uruchamiania instrukcji, które mają osadzony ; jak CREATE PROCEDURE ,CREATE FUNCTION ,CREATE PACKAGE oświadczenia i dla każdego BEGIN...END bloki.