File location when saved in SQL*Plus
The files you create while in SQL*Plus go to the default directory set up for your session, unless you specify a directory path in your save command.
If you started SQL*Plus from a command line prompt, the default directory is the same directory from which you started SQL*Plus.
If you started SQL*Plus from a menu, such as the Start menu in Windows, the default directory is the BIN directory under the home directory for the Oracle software. The full path depends upon which operating system you are using and how the software was installed.
You can see which directory you are in and view the files in that directory by issuing a HOST command.
For example, when running SQL*Plus in Windows, type:
HOST DIR
When running SQL*Plus in UNIX, type:
HOST PWD
SQL Commands
Notice that SQL Commands are often spread over multiple lines and, by default, SQL*Plus automatically displays line numbers during SQL command entry. If your SQL command is fully entered and you want SQL*Plus to execute it for you, you should finish the last line with a semicolon (;) as a delimiter.
If you forget the semicolon, you can still enter that semicolon on the next (empty) line, as shown here:
SQL> select *
2 from employees
3 ;
Either way, the command will execute. SQL*Plus will return all columns and all rows of the EMPLOYEES table, since the asterisk character (*) is used to denote your desire to show all columns of this table.
Using the SQL*Plus Editor
Learning to use the SQL*Plus editing commands is key to being more proficient and efficient in scripting. Instead of starting over if you make a mistake entering a statement, you can make a quick edit and then execute the statement.
The editing commands are the same in all versions of SQL*Plus on all platforms. To explore the SQL*Plus editor, we begin with the same simple SQL SELECT command in the SQL buffer
SQL> select *
2 from employees;
line-oriented
It is important to realize that the SQL*Plus editor is line-oriented; that is, there is only one current line at any point in time. You can make changes only to that current line. SQL*Plus marks the current line on screen with an asterisk (*) after the line number. Normally, it is the line you entered last; in our example, it is the second line. If you want to change something on the first line, you must first activate that line with the L1 command. We will now try to change the asterisk into two column names. C is an abbreviation for the SQL*Plus command CHANGE. Listing 6 below demonstrates how to use the LIST and CHANGE commands to make this change. SQL*Plus searches the current line for the first occurrence of an asterisk (*) and changes that character into eename, bdate.
Listing 6: Using the SQL*Plus LIST and CHANGE Commands
SQL> L
1 select *
2* from employees
SQL> L1
1* select *
SQL> c/*/eename, bdate/
1* select eename, bdate
SQL> L
1 select eename, bdate
2* from employees
SQL>