Datasheet
SQL Fundamentals
13
EXERCISE 1.1
Practicing SQL*Plus File Commands
In this exercise, you will learn how to edit the SQL*Plus buffer using various buffer edit
commands.
1. Enter the following SQL; the third line is a blank line so that the SQL is saved in the
buffer:
SQL> SELECT employee_id, first_name, last_name
2 FROM employees
3
SQL>
2.
List the SQL buffer:
SQL> L
1 SELECT employee_id, first_name, last_name
2* FROM employees
SQL>
3.
Save the buffer to a file named myfile; the default extension will be .sql:
SQL> SAVE myfile
Created file MYFILE.sql
SQL>
4.
Choose to edit the file:
SQL> EDIT myfile
SQL>
5.
Add WHERE EMPLOYEE_ID = 106 as the third line to the SQL statement.
6. List the buffer:
SQL> LIST
1 SELECT employee_id, first_name, last_name
2* FROM employees
SQL>
The buffer listed is still the old buffer. The edited changes are not reflected because
you edited the file
MYFILE, which is not yet loaded to the buffer.
7. Bring the file contents to the buffer:
SQL> GET myfile
1 SELECT employee_id, first_name, last_name
95127c01.indd 13 2/18/09 6:37:07 AM