To run your operating system's default text editor from the SQL*Plus command-line type Edit:
SQL > EDIT
The variable _EDITOR, may be used to setup a preferred text editor, for example, define vi as the SQL*Plus editor:
DEFINE _EDITOR = vi
or define Metapad.exe as the SQL*Plus editor:
DEFINE _EDITOR = Metapad.exe
Include an editor definition like the above in your user profile (login.sql) or site profile ($ORACLE_HOME/sqlplus/admin/glogin.sql) so that it is always enabled when you start SQL*Plus.
To create a new script with a text editor, enter EDIT followed by the name of the new file:
SQL > EDIT myscript.sql
The new file will be created in the current directory (wherever you started SQL*Plus)
When you save the script with the text editor, it is saved back into the same file.
You must include a semicolon at the end of each SQL command and a slash (/) on a line by itself after each PL/SQL block in the file.
You can include multiple SQL commands and PL/SQL blocks in a script.
In addition to external editors it is also possible to use the (rather limited) set of editing commands within SQL*Plus itself.
A text Append text at the end of the current line
C/old/new Change old to new in the current line
C/text Delete text from the current line
DEL Delete the current line
L List all lines in the SQL buffer
CLEAR BUFFER Delete all lines