EDIT
Syntax
E[DIT] [stmt_num];
Description
The EDIT statement invokes a text editor to edit the specified statement from the statement history buffer. If the statement number is not specified, the last statement in the history buffer is edited. When you exit the editor, ISQL writes the buffer contents as the last statement in the history buffer.
By default, ISQL invokes the vi editor on UNIX and the MS-DOS editor on Windows. You can change the default by setting the EDITOR environment variable:
setenv EDITOR /usr/local/bin/gmacs
EDITOR = c:\msoffice\winword.exe
Examples
The following example uses the ! (shell) command to show the currently-set value of the EDITOR environment variable in the UNIX environment (it shows that it is set to invoke the GNU emacs editor). Then, the example uses the EDIT command to read in the fifth statement in the history buffer into an editing buffer.
ISQL> ! printenv EDITOR
/usr/local/bin/gmacs
ISQL> EDIT 5;
The following example edits the last statement in the history buffer:
ISQL> select * from systable; -- bad table name!
*
error(-20005): Table/View/Synonym not found
ISQL> EDIT -- invoke an editor to correct the error
.
.
.
ISQL> list -- corrected statement is now the current statement:
select * from systables
ISQL> run -- run the corrected statement
.
.
.