O'Reilly logo

Oracle SQL*Plus: The Definitive Guide, 2nd Edition by Jonathan Gennick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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
                     /ExampleData
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:

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required