Sql*Plus User’s Guide and Reference


Download 5.34 Mb.
Pdf ko'rish
bet60/103
Sana04.08.2023
Hajmi5.34 Mb.
#1665146
1   ...   56   57   58   59   60   61   62   63   ...   103
Bog'liq
E18404-12

Editing the Current Line
The SQL*Plus CHANGE command enables you to edit the current line. Various 
actions determine which line is the current line:

LIST a given line to make it the current line.

When you LIST or RUN the command in the buffer, the last line of the command 
becomes the current line. (Note, that using the slash (/) command to run the 
command in the buffer does not affect the current line.)

If you get an error, the error line automatically becomes the current line.
Example 5–3
Making an Error in Command Entry
Suppose you try to select the JOB_ID column but mistakenly enter it as JO_ID. Enter 
the following command, purposely misspelling JOB_ID in the first line:
SELECT EMPLOYEE_ID, LAST_NAME, JO_ID, SALARY
FROM EMP_DETAILS_VIEW
WHERE JOB_ID='SA_MAN';
You see this message on your screen:
Examine the error message; it indicates an invalid column name in line 1 of the query. 
The asterisk shows the point of error—the mis-typed column JOB_ID.
Instead of re-entering the entire command, you can correct the mistake by editing the 
command in the buffer. The line containing the error is now the current line. Use the 
CHANGE command to correct the mistake. This command has three parts, separated 
by slashes or any other non-alphanumeric character:

the word CHANGE or the letter C

the sequence of characters you want to change

the replacement sequence of characters
The CHANGE command finds the first occurrence in the current line of the character 
sequence to be changed and changes it to the new sequence. You do not need to use 
the CHANGE command to re-enter an entire line. 
Example 5–4
Correcting the Error
To change JO_ID to JOB_ID, change the line with the CHANGE command:
CHANGE /JO_ID/JOB_ID
The corrected line appears on your screen:
SELECT EMPLOYEE_ID, LAST_NAME, JO_ID, SALARY
*
ERROR at line 1:
ORA-00904: invalid column name
1* SELECT EMPLOYEE_ID, FIRST_NAME, JOB_ID, SALARY


Editing Scripts in SQL*Plus Command-Line
Using Scripts in SQL*Plus
5-5
Now that you have corrected the error, you can use the RUN command to run the 
command again:
RUN
SQL*Plus correctly displays the query and its result:
Note that the column SALARY retains the format you gave it in 
Example 4–4, 
"Entering a SQL*Plus Command"
. (If you have left SQL*Plus and started again since 
performing 
Example 4–4, "Entering a SQL*Plus Command"
the column has reverted to 
its original format.)
See 
CHANGE
 on page 12-22 for information about the significance of case in a 
CHANGE command and on using wildcards to specify blocks of text in a CHANGE 
command.

Download 5.34 Mb.

Do'stlaringiz bilan baham:
1   ...   56   57   58   59   60   61   62   63   ...   103




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling