Environment Variables That Affect SQL*Plus

A number of environment variable settings affect the behavior of SQL*Plus. The following sections describe some commonly used environment variables. For detailed descriptions of all the environment variables applicable to your version of SQL*Plus, consult your manual.

Specifying a Search Path for Scripts

Use the SQLPATH environment variable to designate one or more directories containing .sql files you wish to invoke from the SQL*Plus command prompt. Here are two from Linux:

oracle@gennick02:~> SQLPATH=$HOME/sqlplus/ExampleScripts:$HOME/sqlplus
oracle@gennick02:~> export SQLPATH

These commands designate a search path consisting of two directories, which are separated by colons. When you execute a script using this SQLPATH setting, SQL*Plus will search the following directories in order:

  1. Your current working directory, which is the directory you were in when you started SQL*Plus

  2. $HOME/sqlplus/ExampleScripts

  3. $HOME/sqlplus/ExampleData

On Windows systems, you set environment variables from the Advanced tab of the System Control Panel, after clicking the Environment Variables button, as illustrated in Figure 14-1.

Setting SQLPATH on a Windows system
Figure 14-1. Setting SQLPATH on a Windows system

A Windows install of Oracle Database 10g includes a default SQLPATH specified in a registry entry such as the following:


Get Oracle SQL*Plus: The Definitive Guide, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.