Rlwrap, the second

The next handy thing I learned from Tanel was the use of the autocompletion feature in rlwrap. Now, this is nowhere near as sophisticated as the code completion features found in PL/SQL Developer, SQL Developer, or any of the other sophisticated GUI tools. However, it can help when you just don’t remember quite the exact object name that you want to use.

For rlwrap to have auto-completion, you need to have a textfile with the keywords. By default, rlwrap installs some basic files in the /usr/share/rlwrap directory. One file, for example, contains FTP commands.

To have auto-completion with Oracle reserved words, table, program names, etc., you’ll have to create a text file yourself. Tanel, onceĀ  again, has made a handy script available for this in his script library. You can easily generate such a keyword file yourself by spooling the output on queries against v$reserved_words, dict, dba_objects, dba_procedures, etc.

Once you have such a file, reference it in your rlwrapped call to sqlplus:

rlwrap -if my_keyword_file.txt sqlplus

Use the -i switch to for case insensitivity.

Of course you can now use this feature with the setup I’ve suggested earlier.