LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Why won't sqlplus give me a command history? (https://www.linuxquestions.org/questions/linux-software-2/why-won%27t-sqlplus-give-me-a-command-history-768517/)

indubitableness 11-11-2009 04:28 PM

Why won't sqlplus give me a command history?
 
I was using oracle 11g on a windows vm. The vm broke itself to an irreparable state and I decided I would use a slackware VM so I can maintain a usable install of 11g.

After a pain in the ass of a time I got it running. I am doing homework and when I press up to edit a command I've given previously all I get is ^[[A. I can't even use home or end keys.

Why can't I get a history on sqlplus? I'm used to just being able to push "up." I can't even paste code in with the intention of editing it because it runs it immediately and fails. Even when I edit it in an editor and paste it it seems to detect line breaks or something and errors out.

pattwo 11-11-2009 05:07 PM

Hi

You must remember that SQLPlus is not your shell. It doesn't have the same capabilities.

Oracle sqlplus documentation here.

You're probably better off doing your editing in an editor and running the script from sqlplus. Something like:
Code:

sqlplus username/password @name_of_file_containing_sql_script

indubitableness 11-11-2009 10:23 PM

It can do it in windows so I'm kind of confident it must work in linux. There's got to be some kind of command history file I can set with an environment variable or something.

HAZAAH I am [edit] apparently not [edit] victorious!

Quote:

Standard command history

It is very important to use a common set of UNIX command history and command editing keystrokes. By adding the following command to your .profile, you instruct UNIX to use the vi command editor from your UNIX prompt

#*****************************************************************
# Keyboard commands
#*****************************************************************
stty erase ^?
set -o vi
The set –o vi command enables the following UNIX keystrokes for quickly locating and re-executing UNIX commands:
* <esc> k – Page through previous commands
* <esc> \ - Search the command history for a command with a string
* <esc> \ - automatic command completion for file names

Having a common editor between Oracle servers ensures the common look-and-feel regardless of the current Oracle server.
Source: http://www.rampant-books.com/op_unix...tor_prompt.htm

Quote:

The above is an excerpt from the "Oracle9i UNIX Administration Handbook" by Oracle press, authored by Donald K. Burleson.

indubitableness 11-12-2009 01:34 AM

Okay last thing didn't work. Don't know what I'm doing with the vi stuff. I found this:

http://utopia.knoware.nl/~hlub/rlwrap/man.html

Got a buildscript from slackbuilds.org and used it. Works perfectly. All is right with the world.


All times are GMT -5. The time now is 01:59 AM.