Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL*PLUS Newbie Question

Re: SQL*PLUS Newbie Question

From: Jeffery Cann <jcann_at_fairway.com>
Date: 1998/03/24
Message-ID: <351824B0.A74F8AA8@fairway.com>#1/1

cathexis_at_erols.com wrote:
>
> Dear Group,
> A newbie question:
> When entering exercises from Oracle books( "Beginner's Guide",
> etc.) I have an annoying problem. Once I've typed in a multi. line
> command, if I notice a typo in ,say line #3, the progam won't let me
> use tab or the mouse, arrow keys, whatever to back up and correct it.

You have at least 2 options.

The first is to type 'edit' at the SQL> command prompt. This will launch notepad (by default) and the lines contained in the SQL command buffer will be in notepad as a file. Then, after you edit the file and exit notepad, your edited changes are pasted back into the SQL command buffer. BTW-you can use any text editor in place of notepad, you just have to set it up in SQL*PLUS (check the manual for details).

The second option is to use the 'command line editing' that is built in to SQL*PLUS. For example, here's a simple 3 line select:

SQL> SELECT MY_DATA FROM MY_TABLE
2> WHERE MY_DATE_ENTERED > SYSDATE
3> ORDERBY MY_DATA Notice that the ORDERBY in line 3 is incorrect, it should be 2 words: ORDER BY. To fix this, I would type 3 (and hit enter) at the SQL command prompt to select line 3 as the line I am about to edit:

SQL> 3 (hit enter)

The I can use the change command (abbreviated as c) to change ORDERBY to ORDER BY SQL> c/ORDERBY/ORDER BY (hit enter)

Then I can type the list command (abbr. as l) to list the lines in my SQL buffer:

SQL> l (hit enter)

1> SELECT MY_DATA FROM MY_TABLE
2> WHERE MY_DATE_ENTERED > SYSDATE
3> ORDERBY MY_DATA

Using the edit command is more useful when you are making a lot of changes. Using the command mode is useful for simple typos.

Cheers.
Jeff

-- 
Jeffery C. Cann
Senior Software Engineer
Fairway Systems, Inc.
Received on Tue Mar 24 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US