CHANGE CLPPlus command
The CHANGE CLPPlus command modifies specified content in the SQL buffer. If you set the buffer reader to a specific line in the buffer, the command modifies only the specified content in that line.
The CHANGE or C token is optional for the complete command when specifying which line in the buffer you are changing. You can issue the command by specifying only the line number in the buffer you want to change along with the new text.
Invocation
This is a line-editor command used to modify fields in the SQL buffer.
Authorization
None
Required connection
None
Command syntax
Command parameters
-
n
- Specifies the line number in the buffer that will be changed. The n command only takes the replacement-string variable. search-string
- Defines the text in the SQL buffer to be replaced or deleted.
If the buffer contains more than one line of text, specify the line
to be modified by entering the line number at the prompt before you
run the CHANGE command.
If the text to search for contains an asterisk (*), enclose the asterisk in single quotation marks.
replacement-string
- Specifies the replacement text or specifies that text is to be
removed. If you specify a value for replacement-string,
the first occurrence of the value of search-string is
replaced with the value of replacement-string.
If you do not specify a value for replacement-string,
the first occurrence of the value of search-string is
removed.
If the replacement text contains an asterisk (*), you do not need to enclose an asterisk (*) in single quotation marks.
Examples
In the following example, the LIST command
displays the contents of the buffer. At the SQL prompt, 3 is
entered to move the buffer reader to the start of the third line in
the buffer. The third line becomes the new current line, as indicated
by an asterisk. The CHANGE command then replaces
the occurrence of the string 20
with the string 30
.
The LIST command then displays the modified text
within the buffer.
SQL> LIST
1 SELECT EMPNO, ENAME, JOB, SAL, COMM
2 FROM EMP
3 WHERE DEPTNO = 20
4* ORDER by EMPNO
SQL> 3
3* WHERE deptno = 20
SQL> CHANGE /20/30/
3* WHERE DEPTNO = 30
SQL> LIST
1 SELECT EMPNO, ENAME, JOB, SAL, COMM
2 FROM EMP
3* WHERE DEPTNO = 30
4 ORDER by EMPNO
SQL> SELECT EMPNO FROM EMPLOYEE
EMPNO
is replaced with *
, 1 is
entered to move the buffer reader to the start of the first line in
the buffer. The following CHANGE command is issued:SQL> CHANGE /empno/'*'/
1* SELECT * FROM EMPLOYEE
The command output displays the line number followed by the new content for that line.
You can use the CHANGE command to specify the line number in the buffer you want to change, and what value you want to change it to.
SQL> SELECT *
2 FROM
3 EMPLOKEE ;
ERROR near line 1:
SQL0204N "SCHEMA.EMPLOKEE" is an undefined name.
SQL> LIST
1 SELECT *
2 FROM
3* EMPLOKEE
SQL> 3 EMPLOYEE
3* EMPLOYEE
SQL> LIST
1 SELECT *
2 FROM
3* EMPLOYEE
SQL> /