Thursday, October 27, 2005

Howto set Sqlplus Command history and other features

First of all, Haaaaaaaaaaaaaa!!!!

There is a way to add command line history and command line editing to all command line tools that doesn't support this feature and the tool I talk about is sqlplus (include support for TAB auto complete).

The utility that will make your life much easier is rlwrap

Well, this utility uses the readline library, so to install rlwrap you need to install readline.

Where to find rlwrap:
The latest rlwrap source code can be found in: http://utopia.knoware.nl/~hlub/uck/rlwrap
A bit old RPM version for linux i386 can be found at: http://www.dizwell.com/downloadables/rlwrap-0.18-1.i386.rpm
Other RPM versions can be found at: http://rpm.pbone.net/index.php3?stat=3&search=rlwrap&srodzaj=3 For now (27/10/2005) there are versions for Suse and ALTlinux.

The project can also be found at http://freshmeat.net/projects/rlwrap/

After you installed it, all you need to do is:
rlwrap sqlplus

Creating an alias for "rlwrap sqlplus" will make it easier to use:
alias sqlplus="rlwrap sqlplus"

I've managed to install rlwrap in RH and in Solaris 8, all I needed is nawk, gcc and gnu readline that can be found at http://cnswww.cns.cwru.edu/~chet/readline/rltop.html or at http://www.sunfreeware.com/programlistsparc8.html#readline (didn’t tried it)


Have fun,
Oded.