SQL*Plus User's Guide and Reference

Contents Index Home Previous Next

INPUT

Purpose

Adds one or more new lines of text after the current line in the buffer.

Syntax

I[NPUT] [text]

Terms and Clauses

Refer to the following for a description of the term or clause:

text Represents the text you wish to add. To add a single line, enter the text of the line after the command INPUT, separating the text from the command with a space. To begin the line with one or more spaces, enter two or more spaces between INPUT and the first non-blank character of text.
To add several lines, enter INPUT with no text. INPUT prompts you for each line. To leave INPUT, enter a null (empty) line.

Usage Notes

If you enter a line number at the command prompt larger than the number of lines in the buffer, and follow the number with text, SQL*Plus adds the text in a new line at the end of the buffer. If you specify zero (0) for the line number and follow the zero with text, then SQL*Plus inserts the line at the beginning of the buffer (that line becomes line 1).

Examples

Assume the SQL buffer contains the following command:

1  SELECT ENAME, DEPTNO, SAL, COMM
2  FROM EMP

To add an ORDER BY clause to the query, enter

SQL> LIST 2
  2* FROM   EMP
SQL> INPUT ORDER BY ENAME

LIST 2 ensures that line 2 is the current line. INPUT adds a new line containing the ORDER BY clause after the current line. The SQL buffer now contains the following lines:

1  SELECT ENAME, DEPTNO, SAL, COMM
2  FROM  EMP
3* ORDER BY ENAME

To add a two-line WHERE clause, enter

SQL> LIST 2
  2* FROM EMP
SQL> INPUT
  3  WHERE JOB = 'SALESMAN'
  4  AND COMM  500
  5

INPUT prompts you for new lines until you enter an empty line. The SQL buffer now contains the following lines:

1  SELECT ENAME, DEPTNO, SAL, COMM
2  FROM EMP
3  WHERE JOB = 'SALESMAN'
4  AND COMM  500
5  ORDER BY ENAME


Contents Index Home Previous Next