SQLPlus Commands
SQLPlus Commands
SQLPlus Commands
Oracle SQLPLUS
(For 60-315, Fall 2023)
Some SQLPLUS Commands
Note that:
1. you ought to have installed GlobalProtect VPN to be able to connect to
any of the CS servers through Bitvise SSH or NoMachine.
Information on How to Install or Update GlobalProtect VPN
• New University VPN Users: View the KBAs with instructions on how to install
the Global Protect VPN.
• Existing University VPN Users: Find Update the VPN per the KBA to see how
to remove the old portal networklogin.uwindsor.ca to the
new securelogin.uwindsor.ca.
• Should you require help with the VPN, please contact the IT Service Desk
by opening a ticket, calling 519-253-3000 ext. 4440 or selecting the chat icon in
the bottom right corner of uwindsor.ca/its or uwindsor.ca/itshelp.
2. You ought to have synchronized your UWindsor email password
with the Oracle Sqlplus password (i) every time you change your
UWindsor email password, (ii) first time you are logging
onto Sqlplus on cs servers, and (iii) any time you are working
on Sqlplus on our cs server and got locked out.
To synchronize, go to http://cs.uwindsor.ca/password. Then, follow the
appropriate buttons to synchronize.
The characters that can be used for an Oracle/UWindsor
password without enclosing it in double quotes are the same as
any normal Oracle identifier: only letters, numbers, and the
symbols #, _, and $ are acceptable, and the first character must
be a letter. If your password includes any other characters, the entire
2
When connected to the computer science system bravo.cs.uwindsor.ca, you can use
SQLPLUS Oracle’s interactive Interface to the database server. SQL statements can be
issued at the SQL> prompt and file containing SQL statements can be executed from
within SQLPLUS.
2. Oracle SQLPLUS
Oracle’s SQLPLUS program provides a convenient interactive environment with the
Oracle Database Server. The user may type the commands directly at the SQL> prompt
or have SQLPLUS execute commands residing in operating system files.
To enter the SQLPLUS environment, the sqlplus program should be executed (launched)
from Unix/Linus command line in one of the following two ways, where
<user id> is the oracle user identification and
<password> is the associated password:
• sqlplus <userid>
• sqlplus
The Oracle userid and password may be different from the userid and password to get
access to the operating system (with the current Oracle DBMS 11g, it is the same
password for both your server account and Oracle account).
3
If the sqlplus program is invoked with only <userid>, the program prompts the user for
the password; if it is invoked without any parameters, the program prompts for the
<userid> and <password>
To Exit the SQLPLUS environment, the exit or quit command must be entered at the
SQL> prompt.
SQL> quit
Once the user is within the SQLPLUS environment, the system will usually display the
prompt SQL> and wait for the user commands. The user may enter three kinds of
commands:
SQL statements can be entered at the SQL> prompt. A statement may be broken into
multiple lines. SQLPLUS displays a line number (starting at 2) after the user presses the
RETURN key to go to the next line. The SQL statement may be terminated in one of the
three ways:
• With a semicolon (;), indicating to SQLPLUS that it should execute the statement
immediately.
• With a slash (/) on a line by itself, also indicating to SQLPLUS that it should
execute the statement immediately.
• With a blank line, indicating to SQLPLUS that it should not do anything with the
statement. The statement is stored in a buffer and can be executed at a later stage
The following is a screen capture of an SQL statement executed in SQLPLUS from the
CEZEIFE ACCOUNT
SQL Statement:
SQL> select course_no AS course#, c_title "course title", c_credit " course credit"
2 from uw_courses;
4
Figure2.2
Figure 2.3
5
You can also enter PL/SQL anonymous blocks at the SQL> prompt for execution and
issue statements such as create function and create procedure at the SQL> prompt to
create PL/SQL stored objects.
The PL/SQL anonymous block is executed by typing the “run” command at the SQL>
prompt.
Besides SQL and PL/SQL, users can also enter SQLPLUS commands at the SQL>
prompt. These commands can manipulate SQL commands and PL/SQL blocks, format
and print query results, and set various options for SQLPLUS. SQLPLUS must be
entered in one line. If the command is long, it may be continued to the next line by typing
the hyphen symbol (-) at the end of the line before pressing the RETURN key. Here is an
example of an SQLPLUS command that formats a column of the SQL query.
SQL Statement
SQL> select course_no AS course#, c_title "course title", c_credit " course credit"
2 from uw_courses;
Figure 2.4
The column command formats a particular column in the current query (in this case the
6
column is formatted and given a different name for display purposes). SQLPLUS
commands need not be terminated with semicolon
The following are a few of the more commonly used SQLPLUS commands
• describe [desc] List the column definitions for a database table. The following is
an example of the describe command
Figure 2.5
Figure 2.6
7
Will list the description of the column command. To get a list of all commands
use the following command:
• host. Execute a host operating system command without leaving SQLPLUS. For
example,
Will list all the files in the current directory with a .sql extension. The
exclamation key (!) may be used instead of the host command to achieve the same
effect.
Figure 2.7
• remark. Used for comments. Any line beginning with keyword remark or rem or
two hyphens (--) is treated as a comment and is ignored by SQLPLUS.
• Run. Executes the SQL statement present in the buffer. The run command works
the same as the slash command, except that it also displays the buffer contents
before executing the statement in the buffer.
• Set. Sets SQLPLUS system variables. Some of the more useful system variables
include
Setting pause to on causes SQLPLUS to pause at the beginning of each page. The
user must press RETURN key to see the next page.
Setting echo to on causes SQLPLUS to list each commands in a file when the file
is run with the start command. The names of other system variables, along with
explanations, can be obtained by using help on the set command.
9
Figure 2.8
make a particular line the current line, simply list that line by typing the line number
the following SQLPLUS session illustrates some of the editing commands.
Figure 3.1
11
Figure 3.2
12