Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

os environment variables in sql-queries

Status
Not open for further replies.

lowlander

IS-IT--Management
Sep 29, 2002
4
GB
How can I use os (windows) environment variables like
'%ORACLE_HOME%' in sql-queries (+ pl/sql)
 
One way is to use an operating command or batch file to dynamically generate a SQL script (using the environment variables as you wish) that can be executed by SQL*PLUS.

For instance (Windows cmd file):
Code:
ECHO select * from filename > script.sql
ECHO where columnname = '%xxx%' >> script.sql
ECHO exit >> script.sql
%orclhome%\BIN\SQLPLUS.EXE -silent sys/password @script.sql
DEL script.sql
 
While there are clever ways to get information from
the operating system (pipes, extproc, etc), there is a lot of information in v$parameter and v$session that may be of use to you as well...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top