In sqlplus heaven with gqlplus

December 17, 2006

I just found “gqlplus”: today when looking for a way to enable command-line history in the SQL*Plus command that comes with Oracle’s “Instant Client”:

bq. _gqlplus_ is a drop-in replacement for sqlplus, an Oracle SQL client, for UNIX and UNIX-like platforms. The difference between _gqlplus_ and sqlplus is *command-line editing and history, plus table-name and column-name completion*. As you know if you have used sqlplus, it is notoriously difficult to correct typing errors and other mistakes in your SQL statements. sqlplus does give you ability to use external editor to edit a statement, but only the last statement you typed. _gqlplus_ solves this problem by providing the familiar command-line editing and history as in tcsh or bash shells, and table/column-name completion, while otherwise retaining compatibility with sqlplus.

To install on OS X, simply “download”:, untar and do the usual configure/make ritual, with @–disable-shared@ passed to configure (see “this page for details”: but note that it’s no longer necessary to patch gqlplus):

$ ./configure --disable-shared
$ make

and then move the binary to “/usr/local/bin”: You may want to pass @-d@ to gqlplus, to disable column-name completion, as it can take quite a while to load the meta data required, but otherwise gqlplus is truly a joy to use.

Update 2009-03-10:
If you want to substitute all calls to sqlplus with gqlplus, add an alias to your .profile (or .bash_profile):

alias sqlplus='gqlplus'    # with auto-completion 
alias sqlplus='gqlplus -d' # without auto-completion