Using SQLPlus

Prelude – Have begun learning Oracle as part of my Databases course.  

I found a lot of tutorials on writing SQL in Oracle, and getting info about the tables, but there’s a few tutorials that explain how to actually type in the commands into the SQLPlus editor. This is for those of us who do not have access to the web-driven version. The thing I was searching for was how to delete a mistake!

As stupid and wierd as that sounds, if you’ve typed in it and pressed the BACKSPACE key, you’ll know what I mean, i.e. on the server I have access to, the BACKSPACE key does not erase things I type into SQLPlus. Instead it prints out ‘funny’ characters: H^

Actually, neither does the DELETE key because of two reasons:

  • Pressing the BACK arrow key will print up more funny characters: [[D^
  • Pressing the DELETE key itself will give you more of those: [[3~

So all I was looking for was what to press to erase characters in SQLPlus. By trial-and-error, I found the following stuff:

  • To erase entire words, press CTRL + W
  • To erase single characters, press CTRL + BACKSPACE

3 comments so far

  1. Dejay Clayton on

    From the command prompt, BEFORE starting SQLPlus, type the following command:

    stty erase [CTRL-V,BACKSPACE]

    NOTE: Do not type [CTRL-V,BACKSPACE] – instead, press the CTRL-V key and then press the BACKSPACE key. When you do so, it will show up on the screen as “^H”. It’s a special command character, that’s how it’s supposed to look.

    Then, if that doesn’t solve the problem entirely, type the following command from WITHIN SQLPlus:

    !stty erase [BACKSPACE]

    Again, do not type [BACKSPACE], just press the BACKSPACE KEY. It will show up on the screen as “^H”. That should solve all your problems.

  2. Alexander Murdoch on

    Also, if you want to set “stty erase ^H” at the time you log into the system, you might add this line

    stty erase ^H

    into the .profile, .bash_profile or .cshrc file in your home directory.

    Alex.

  3. zen on

    Thanks. This is very useful information.


Leave a reply