The EDIT Command

You don't like line-editing? SQL*Plus does not have a built-in full-screen editor, but it does have the EDIT command. The SQL*Plus EDIT command allows you to invoke the text editor of your choice to use in editing SQL statements and PL/SQL blocks.

Choosing Your Editor

Although you issue the EDIT command, SQL*Plus invokes the editor named in a SQL*Plus user variable named _EDITOR. You can view the current editor choice by issuing the command DEFINE _EDITOR, as follows:

SQL> DEFINE _EDITOR
DEFINE _EDITOR         = "ed" (CHAR)

If you don't like the default choice (and I'm reasonably certain you won't), you can change the editor, but only for the duration of your current session, using another variation of the DEFINE command:

DEFINE _editor = "vi"

Now, SQL*Plus will invoke the vi editor in response to the EDIT command.

If you're using the Windows version of SQL*Plus, you can change the value of EDITOR from the GUI, using Edit → EditorDefine → Editor, as shown in Figures Figure 2-6 and Figure 2-7. The default editor choice under Windows is Notepad.

The Define Editor menu option

Figure 2-6. The Define Editor menu option

Specifying the executable to invoke in response to the EDIT command

Figure 2-7. Specifying the executable to invoke in response to the EDIT command

To make an editor choice permanent, you can place a DEFINE _EDITOR command in either your global or local login file. ...

Get Oracle SQL*Plus: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.