dbTalk Databases Forums  

unix vs. windows: env variables in sqlplus

comp.databases.oracle.tools comp.databases.oracle.tools


Discuss unix vs. windows: env variables in sqlplus in the comp.databases.oracle.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
william milbratz
 
Posts: n/a

Default unix vs. windows: env variables in sqlplus - 07-25-2003 , 07:23 PM






Hi,

Can I access environment variables from sqlplus in OS-neutral fashion?

I couldn't find anything in the official documentation, but I came
across a post on experts-exchange that suggested I could access
environment variables in an sqlplus script as follows:

SET FEEDBACK OFF;
@ %TEMP%/gen.sql
@ %TEMP%/gen_ja.sql
SET FEEDBACK ON;

Turns out it works fine on Windows, but Unix requires the traditional
'$...' format.
@ $TEMP/gen.sql

I'd like to keep my scripts OS-neutral and stay away from SED simply
to substitute '$TEMP' with '%TEMP%' and such.

any suggestions?

I'm running 8.1.7

thanks,

bill milbratz

Reply With Quote
  #2  
Old   
Gerard H. Pille
 
Posts: n/a

Default Re: unix vs. windows: env variables in sqlplus - 07-27-2003 , 04:53 AM






william milbratz wrote:
Quote:
Hi,

Can I access environment variables from sqlplus in OS-neutral fashion?

I couldn't find anything in the official documentation, but I came
across a post on experts-exchange that suggested I could access
environment variables in an sqlplus script as follows:

SET FEEDBACK OFF;
@ %TEMP%/gen.sql
@ %TEMP%/gen_ja.sql
SET FEEDBACK ON;

Turns out it works fine on Windows, but Unix requires the traditional
'$...' format.
@ $TEMP/gen.sql

I'd like to keep my scripts OS-neutral and stay away from SED simply
to substitute '$TEMP' with '%TEMP%' and such.

any suggestions?

I'm running 8.1.7

thanks,

bill milbratz
Hallo Bill,

aren't you asking a bit too much? OS-neutral environment variables? I
thought the environment was part of the OS, but then I have been on
holidays.

Does "@ %TEMP%/gen.sql" work? I thought µicro$oft used backslashes,
but then ...

Maybe I could try to give some serious advice.

Don't use the OS in your scripts: for this specific problem, you could
define "ORACLE_PATH" in the OS, before starting Sqlplus, and add your
temporary directory to it. So your script would work on both Whinedoze
and (Li|U)n(u|i)x.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.