Below is a list of the most common SQL editing commands. Words in caps are the commands to be typed exactly as shown. Lower case words will be your data.
| ACTIVITY | COMMAND | ABBREVIATION |
|---|---|---|
| Add text at end of current line | APPEND text | A text |
| Change current line | Type the line number | ----- |
| Change text in current line | CHANGE/old/new | C/old/new |
| Delete all lines from buffer | CLEAR BUFFER | CL BUFF |
| Delete current line | DEL | DEL |
| Edit the entire command currently in the buffer using an editor such as Notepad | EDIT | ED |
| Insert line following current line | INPUT | I |
| List the command currently in the buffer | LIST | L |
| Run the Command currently in the buffer | RUN | R |
| To execute a command without displaying it | / | ----- |
Type in the program code (all 10 lines) in Oracle SQL*Plus first, then correct the errors using the commands below the following table.
| Line Number | Program code | Error |
|---|---|---|
| 1 | CREATE TABLE SALE | ----- |
| 2 | (S_NO CHAR(2), | ----- |
| 3 | LAST CHAR(10), | ----- |
| 4 | FIRST CHR(8), | CHR should be CHAR |
| 5 | STREET CHAR(15) | comma missing |
| 6 | STATE CHAR(2), | CITY column missing |
| 7 | XXX CHAR(10), | XXX column to be deleted |
| 8 | ZIP_CODE CHAR(5), | ----- |
| 9 | TOT_COMMISSION DECIMAL(7,2), | ----- |
| 10 | COMM_RATE DECIMAL(3,2)); | ----- |
Commands to edit and correct the errors:
SQL > 4
SQL > C/CHR/CHAR
SQL >5
SQL >A ,
SQL >7
SQL >DEL
SQL >5
SQL >INPUT
SQL >CITY CHAR(15),
SQL >RUN
SQL >L
To edit the entire command all at once, invoke the editor (use the command ED) and then save the file.