Sql*Plus User’s Guide and Reference


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

Appending Text to a Line 
To add text to the end of a line in the buffer, use the APPEND command.
1.
Use the LIST command (or the line number) to list the line you want to change.
2.
Enter APPEND followed by the text you want to add. If the text you want to add 
begins with a blank, separate the word APPEND from the first character of the text 
by two blanks: one to separate APPEND from the text, and one to go into the 
buffer with the text.
Example 5–5
Appending Text to a Line
To append a space and the clause DESC to line 4 of the current query, first list line 4:
LIST 4
Next, enter the following command (be sure to type two spaces between APPEND and 
DESC):
APPEND DESC
Type RUN to verify the query:
1 SELECT EMPLOYEE_ID, LAST_NAME, JOB_ID, SALARY
2 FROM EMP_DETAILS_VIEW
3* WHERE JOB_ID='SA_MAN'
EMPLOYEE_ID LAST_NAME JOB_ID MONTHLY SALARY
----------- ------------------------- ---------- --------------
145 Russell SA_MAN $14,000
146 Partners SA_MAN $13,500
147 Errazuriz SA_MAN $12,000
148 Cambrault SA_MAN $11,000
149 Zlotkey SA_MAN $10,500
4* ORDER BY SALARY
4* ORDER BY SALARY DESC


Editing Scripts in SQL*Plus Command-Line
5-6
SQL*Plus User's Guide and Reference
Adding a New Line
To insert a new line after the current line, use the INPUT command.
To insert a line before line 1, enter a zero ("0") and follow the zero with text. SQL*Plus 
inserts the line at the beginning of the buffer and all lines are renumbered starting at 1.
0 SELECT EMPLOYEE_ID
Example 5–6
Adding a Line
Suppose you want to add a fourth line to the SQL command you modified in 
Example 5–4, "Correcting the Error"
. Since line 3 is already the current line, enter 
INPUT and press Return. 
INPUT
SQL*Plus prompts you for the new line:
Enter the new line. Then press Return. 
4 ORDER BY SALARY
SQL*Plus prompts you again for a new line:
Press Return again to indicate that you will not enter any more lines, and then use 
RUN to verify and re-run the query.
1 SELECT EMPLOYEE_ID, LAST_NAME, JOB_ID, SALARY
2 FROM EMP_DETAILS_VIEW
3 WHERE JOB_ID='SA_MAN'
4* ORDER BY SALARY DESC
EMPLOYEE_ID LAST_NAME JOB_ID MONTHLY SALARY
----------- ------------------------- ---------- --------------
145 Russell SA_MAN $14,000
146 Partners SA_MAN $13,500
147 Errazuriz SA_MAN $12,000
148 Cambrault SA_MAN $11,000
149 Zlotkey SA_MAN $10,500
4
5
1 SELECT EMPLOYEE_ID, LAST_NAME, JOB_ID, SALARY
2 FROM EMP_DETAILS_VIEW
3 WHERE JOB_ID='SA_MAN'
4* ORDER BY SALARY
EMPLOYEE_ID LAST_NAME JOB_ID MONTHLY SALARY
----------- ------------------------- ---------- --------------
149 Zlotkey SA_MAN $10,500
148 Cambrault SA_MAN $11,000
147 Errazuriz SA_MAN $12,000
146 Partners SA_MAN $13,500
145 Russell SA_MAN $14,000


Placing Comments in Scripts
Using Scripts in SQL*Plus

Download 5.34 Mb.

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




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