Environment Variable Settings

There are a number of environment variables that can affect how SQL*Plus operates. One of the most commonly used of these is the SQLPATH variable. SQLPATH functions much like a command search path, except that it applies to SQL scripts. It contains a list of directories to search when looking for a script. The way you set SQLPATH and other variables depends on the specific operating system you are using. The next few sections demonstrate how SQLPATH is set under Windows 3.1, Windows 95, Windows 98, Windows NT, and Unix. Following these examples is a complete list of all the environment variables that apply to SQL*Plus.

Setting an Environment Variable

Under Unix, SQL*Plus settings are stored in environment variables. You usually set these variables with the Unix export command. The situation is pretty much the same for Windows 3.1 and DOS, except that you use the DOS SET command. In later versions of Windows, such as Windows 95, these settings are stored in the registry.

Unix

To set an environment variable from Unix, you generally use either the export or setenv command, depending on which shell you are using. The following example, using the Korn shell, shows how to set the SQLPATH variable to point to your home directory:

$ export SQLPATH=$HOME

Here is the same example using the C Shell’s setenv command:

$ setenv SQLPATH $HOME

Note that with export you use an equals sign between the variable and the value, while with setenv you do not. You can use ...

Get Oracle SQL*Plus: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.