Professional Documents
Culture Documents
Using SQL*Plus
After
After completing
completing this
this appendix,
appendix, you
you should
should be
be able
able to
to
do
do the
the following:
following:
•• Log
Log in
in to
to SQL*Plus
SQL*Plus
•• Edit
Edit SQL
SQL commands
commands
•• Format
Format output
output using
using SQL*Plus
SQL*Plus commands
commands
•• Interact
Interact with
with script
script files
files
Server
SQL*Plus
Query results
Buffer
SQL
scripts
•• Log
Log in
in to
to SQL*Plus.
SQL*Plus.
•• Describe
Describe the
the table
table structure.
structure.
•• Edit
Edit your
your SQL
SQL statement.
statement.
•• Execute
Execute SQL
SQL from
from SQL*Plus.
SQL*Plus.
•• Save
Save SQL
SQL statements
statements toto files
files and
and append
append SQL
SQL
statements
statements to
to files.
files.
•• Execute
Execute saved
saved files.
files.
•• Load
Load commands
commands from
from file
file to
to buffer
buffer
to
to edit.
edit.
Use
Use the
the SQL*Plus DESCRIBE command
SQL*Plus DESCRIBE command to
to display
display the
the
structure
structure of
of aa table.
table.
DESC[RIBE] tablename
•• A[PPEND]
A[PPEND] text
text
•• C[HANGE]
C[HANGE] // old
old // new
new
•• C[HANGE]
C[HANGE] // text
text //
•• CL[EAR]
CL[EAR] BUFF[ER]
BUFF[ER]
•• DEL
DEL
•• DEL
DEL nn
•• DEL
DEL mm nn
•• I[NPUT]
I[NPUT]
•• I[NPUT]
I[NPUT] text
text
•• L[IST]
L[IST]
•• L[IST]
L[IST] nn
•• L[IST]
L[IST] mm nn
•• R[UN]
R[UN]
•• nn
•• nn text
text
•• 00 text
text
SQL> 1
1* SELECT last_name
SQL> A , job_id
1* SELECT last_name, job_id
SQL> L
SQL> L
1* SELECT * from employees
SQL> c/employees/departments
1* SELECT * from departments
SQL> L
1* SELECT * from departments
•• SAVE
SAVE filename
filename
•• GET
GET filename
filename
•• START
START filename
filename
•• @@ filename
filename
•• EDIT
EDIT filename
filename
•• SPOOL
SPOOL filename
filename
•• EXIT
EXIT
SQL> L
1 SELECT last_name, manager_id, department_id
2* FROM employees
SQL> SAVE my_query
Use
Use SQL*Plus
SQL*Plus as
as an
an environment
environment to:
to:
•• Execute
Execute SQL
SQL statements
statements
•• Edit
Edit SQL
SQL statements
statements
•• Format
Format output
output
•• Interact
Interact with
with script
script files
files