Sql*Plus User’s Guide and Reference
Download 5.34 Mb. Pdf ko'rish
|
E18404-12
- Bu sahifa navigatsiya:
- Example 5–5 Appending Text to a Line
- Example 5–6 Adding a Line
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 |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling