SQL*Plus User's Guide and Reference
Release 8.1.5

A66736-01

Library

Product

Contents

Index

Prev Up Next

Command Reference, 12 of 52


CHANGE

Purpose

Changes the first occurrence of text on the current line in the buffer.

Syntax

C[HANGE] sepchar old [sepchar [new [sepchar]]]

Terms and Clauses

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

sepchar

      Represents any non-alphanumeric character such as "/" or "!". Use a sepchar that does not appear in old or new. You can omit the space between CHANGE and the first sepchar.

old

      Represents the text you wish to change. CHANGE ignores case in searching for old. For example,

      CHANGE /aq/aw
      
      

      will find the first occurrence of "aq", "AQ", "aQ", or "Aq" and change it to "aw". SQL*Plus inserts the new text exactly as you specify it.

      If old is prefixed with "...", it matches everything up to and including the first occurrence of old. If it is suffixed with "...", it matches the first occurrence of old and everything that follows on that line. If it contains an embedded "...", it matches everything from the preceding part of old through the following part of old.

new

      Represents the text with which you wish to replace old. If you omit new and, optionally, the second and third sepchars, CHANGE deletes old from the current line of the buffer.

Usage Notes

CHANGE changes the first occurrence of the existing specified text on the current line of the buffer to the new specified text. The current line is marked with an asterisk (*) in the LIST output.

You can also use CHANGE to modify a line in the buffer that has generated an Oracle error. SQL*Plus sets the buffer's current line to the line containing the error so that you can make modifications.

To reenter an entire line, you can type the line number followed by the new contents of the line. If you specify a line number 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, SQL*Plus inserts the line at the beginning of the buffer (that line becomes line 1).

Examples

Assume the current line of the buffer contains the following text:

4* WHERE JOB IS IN ('CLERK','SECRETARY','RECEPTIONIST')

Enter the following command:

SQL> C /RECEPTIONIST/GUARD/

The text in the buffer changes as follows:

4* WHERE JOB IS IN ('CLERK','SECRETARY','GUARD')

Or enter the following command:

SQL> C /'CLERK',.../'CLERK')/

The original line changes to

4* WHERE JOB IS IN ('CLERK')

Or enter the following command:

SQL> C /(...)/('COOK','BUTLER')/

The original line changes to

4* WHERE JOB IS IN ('COOK','BUTLER')

You can replace the contents of an entire line using the line number. This entry

SQL> 2  FROM EMP e1

causes the second line of the buffer to be replaced with

FROM EMP e1

Note that entering a line number followed by a string will replace the line regardless of what text follows the line number. For example,

SQL> 2  c/old/new/

will change the second line of the buffer to be

2* c/old/new/

Prev Up Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index