SQL* Plus CLI  «Prev 

Setting a SQL*Plus Search Path in Oracle

When you use the @ command to execute a script, SQL*Plus always looks in the current working directory to see if it can find the file. You also can provide SQL*Plus with a list of other directories in which to look. This allows you to easily execute scripts without having to remember, or type in, the directory name every time.
The SQL*Plus search path is called the sqlpath. You set it by storing the search path in an environment variable named sqlpath. Under Unix, using the Korn shell, you can set the sqlpath variable using these commands:

sqlpath:

The name of a UNIX environment variable, or on a Windows registry entry, that defines a search path for SQL*Plus to use in looking for a script file executed by a user.

sqlpath=/sql_scripts;/sql_reports
export sqlpath

If you are using the C shell, you would use the setenv command to set an environment variable. For example:
setenv sqlpath /sql_scripts;/sql_reports

Of course, replace the directories in the example with your own. On Windows NT systems, there are several methods for setting the sqlpath variable. Perhaps the best way is to right-click the My Computer icon, select properties, click the environment tab, and create a sqlpath environment variable. Here's how that looks:

System Properties and System Variables
System Properties and System Variables
Under Windows, you also can modify a registry variable[1] named sqlpath. Changing the registry variable works very well. You just have to find the right one to change. Each Oracle Home entry in your registry will have its own sqlpath setting.

[1] Registry variable: A variable that is stored in the Windows Registry, and that must be edited using the regedit utility.