The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Call sqlplus in the shell script beaniebear Shell Programming and Scripting 3 05-13-2008 06:30 AM
how can i call sqlplus? theodore HP-UX 13 04-25-2008 11:01 AM
how to differentiate system call from library call muru UNIX for Advanced & Expert Users 2 07-19-2007 08:20 PM
Sqlplus LiquidChild Shell Programming and Scripting 9 06-01-2007 08:22 AM
Sqlplus antkiu Shell Programming and Scripting 4 09-13-2006 09:36 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 06-02-2008
Registered User
 

Join Date: Jun 2008
Posts: 1
sqlplus call

I have a .sh file which acts as an all set for a couple of oracle scripts i want to call. Basically it has 3 variables, the user Id, the password, and the oracle instance to connect to.. the problem is I cant seem to get the connection string format properly.. the program essentially is this:

-----------------------

SYSTEM_UID=SYSTEM
SYSTEM_PWD=SYSTEM
DATABASE=myDatabase

CREATEUSERCMD="sqlplus ${SYSTEM_UID}/${SYSTEM_PWD}@${DATABASE}"

echo Printing user Id: ${SYSTEM_UID}
echo Printing pwd: ${SYSTEM_PWD}
echo Printing db: ${DATABASE}
echo Printing connection string: ${CREATEUSERCMD}

----------------------------

Resulting output I get is:

$ bash allset.sh
Printing user Id: SYSTEM
Printing pwd: SYSTEM
Printing db: myDatabase
@myDatabasennection string: sqlplus SYSTEM

Am I resolving those slashes and ampersands incorrectly? Or is there an issue with the way I'm referencing those variables? If I hard code the connection string as:

CREATEUSERCMD='sqlplus SYSTEM/SYSTEM@myDatabase'
and then just call : ${CREATEUSERCMD} it works fine.
Reply With Quote
Forum Sponsor
  #2  
Old 06-05-2008
Registered User
 

Join Date: Dec 2007
Posts: 1
Depends on what you are trying to do. For example

Code:
SQL_RESULT=`sqlplus -s "${USERID}/${PASSWORD}@${ORA_SID}" << EOF 
    
  -- sqlplus commands here...
    
exit

EOF`
will cause the result of your SQL*Plus script to be saved in variable SQL_RESULT. Note the back-ticks. You could then

echo "$SQL_RESULT" to see the result.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0