App D
App D
App D
Using SQL*Plus
SQL statements
Server
SQL*Plus
Query results
Buffer
SQL
scripts
SQL SQL*Plus
• A language • An environment
• ANSI-standard • Oracle-proprietary
• Keywords cannot be • Keywords can be
abbreviated. abbreviated.
• Statements manipulate • Commands do not
data and table allow manipulation of
definitions in the values in the database.
database.
• Log in to SQL*Plus.
• Describe the table structure.
• Edit your SQL statement.
• Execute SQL from SQL*Plus.
• Save SQL statements to files and append SQL
statements to files.
• Execute saved files.
• Load commands from file to buffer to edit.
DESC[RIBE] tablename
• A[PPEND] text
• C[HANGE] / old / new
• C[HANGE] / text /
• CL[EAR] BUFF[ER]
• DEL
• DEL n
• DEL m n
• I[NPUT]
• I[NPUT] text
• L[IST]
• L[IST] n
• L[IST] m n
• R[UN]
• n
• n text
• 0 text
SQL> LIST
1 SELECT last_name
2* FROM employees
SQL> 1
1* SELECT last_name
SQL> A , job_id
SQL> L
SQL> L
SQL> c/employees/departments
SQL> L
• SAVE filename
• GET filename
• START filename
• @ filename
• EDIT filename
• SPOOL filename
• EXIT
SQL> L
1 SELECT last_name, manager_id, department_id
2* FROM employees
SQL> SAVE my_query