Oracle Editing Commands

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.

ACTIVITYCOMMANDABBREVIATION
Add text at end of current lineAPPEND textA text
Change current lineType the line number-----
Change text in current lineCHANGE/old/newC/old/new
Delete all lines from bufferCLEAR BUFFERCL BUFF
Delete current lineDELDEL
Edit the entire command currently in the buffer using an editor such as NotepadEDITED
Insert line following current lineINPUTI
List the command currently in the bufferLISTL
Run the Command currently in the bufferRUNR
To execute a command without displaying it/-----

Example

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 NumberProgram codeError
1CREATE TABLE SALE-----
2(S_NO CHAR(2),-----
3LAST CHAR(10),-----
4FIRST CHR(8),CHR should be CHAR
5STREET CHAR(15)comma missing
6STATE CHAR(2),CITY column missing
7XXX CHAR(10),XXX column to be deleted
8ZIP_CODE CHAR(5),-----
9TOT_COMMISSION DECIMAL(7,2),-----
10COMM_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.


Amita Goyal Chin, Ph.D.