Line Editing

The concept of line editing goes way back to the days when all many people had to work with were dumb terminals that didn’t allow full-screen editing, and connection speeds were so slow that full-screen editing would have been very painful anyway. A good line editor will allow you to work productively at speeds as low as 300 bits per second. While this isn’t much of a concern today, it accurately reflects the environment at the time SQL*Plus was first conceived.

The line-editing process in SQL*Plus follows these steps:

  1. You enter a SQL statement or PL/SQL block, which SQL*Plus stores in the buffer.

  2. You then list the contents of the buffer to the screen.

  3. You enter SQL*Plus commands that tell SQL*Plus to make changes to the statement in the buffer.

  4. You list the buffer again.

  5. If you like what you see, you execute the statement; otherwise, you go back to step three and make some more changes.

I can remember that in my younger days my fellow programmers and I always took a great pride in the number of line-editing changes we could make and visualize in our heads before we had to break down and list our code again.

The Current Line

When working with the line editor in SQL*Plus, it’s important to understand the concept of the current line. Simply put, the current line is the one that you have most recently “touched.” When you are entering a statement, the most recently entered line is the current line. Consider the following SQL statement for example:

SQL> SELECT employee_name, ...

Get Oracle SQL*Plus: The Definitive Guide 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.