SQL*PLUS and SQL Developer both are client application for Oracle database. These applications just validate the syntax of statements and submit to Oracle Database server for execution. As far as the question is concerned about the uses of /
and ;
in these application I would like to demostrate as best as I can.
SQL*PLUS
In SQL*PLUS-
;
is used to end the current statement.
/
is used to end current statement as well as If you are in the SQL prompt(SQL>
) to run the command which are in the buffer.
Examples:
To end and execute the statement-
SQL> select * from jobs;
SQL> select * from jobs
2 /
To run the command which is in the buffer(Only the SQL command(not SQL*PLUS command) and the last executed command remains in the buffer).
SQL> /
Instead, you can use RUN
command for the same purpose. The difference is /
doesnt show the command being executed but RUN
does.
SQL> RUN
1* select * from jobs
SQL*PLUS treats PL/SQL program as the SQL command except the ;
and the blank line. In normal SQL command if you insert an blank line then it terminates the command as shown below.
SQL> select * from jobs
2
SQL>
But in PL/SQL block it doesnt terminate the program.
To terminate and execute the PL/SQL block we use the same /
.
SQL Developer
In SQL Developer we use CTRL+ENTER
or F5
keys to execute commands. We dont need to use ;
and /
to indicate the end of the command instead we use Run Statement(CTRL+ENTER)
or Run Script(F5)
.