Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 13th, 2004, 06:47 AM
paulizzo paulizzo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 paulizzo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Using Operating System Environment Variables in SQLPLUS

I'm looking for a way to use the Operating System Environment Variables inside of a sql script. I'd like to create a generic script that will run on all machines regardless of directory structure. I know that in SQLPLUS I can call on Operating System commands using ! followed by the Operating System command. But I'd like to use a SQL command using a Operating System variable. Example:

spool $ORACLE_BASE/assistants/dbca/logs/CreateDB.log
startup nomount pfile="$ORACLE_BASE/admin/orc3/pfile/init.ora";

Reply With Quote
  #2  
Old July 13th, 2004, 10:17 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,307 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 28 m 57 sec
Reputation Power: 48
You really can't. Here's how to do it in Unix with ksh:
The $BANNER_HOME and $ORACLE_HOME are environment variables defined for all users....
UID = user
UIPW= user/passwd
Code:
UID=$1
UIPW=$1/$2
ONE_UP=$3

SQLDIR=$BANNER_HOME/pnm/dbprocs
CTLLOC=$BANNER_HOME/data
SORTDIR=$BANNER_HOME/sortdir
OUTDIR=$BANNER_HOME/out
UPUID=$(echo $UID | tr "[:lower:]" "[:upper:]")

export SQLDIR CTLLOC SORTDIR OUTDIR

PrntCode=$(echo "$UIPW
           set pages 0
           SELECT gjbjobs_prnt_code
           FROM   gjbjobs
           WHERE  gjbjobs_name = 'UZPGLTT'; " |
           $ORACLE_HOME/bin/sqlplus -s )


You can do something like this in perl, but again the same script will not work on any platform without serious coding effort.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Using Operating System Environment Variables in SQLPLUS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway