Computing.Net > Forums > Solaris > Assign value to local variable

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Assign value to local variable

Reply to Message Icon

Name: phatboyslymm
Date: November 13, 2005 at 23:38:12 Pacific
OS: Windows XP
CPU/Ram: 1GHz PIII
Comment:

Is it possible to use a shell script to login to a database (using SQLPLUS), run a query and assign the query result to a local variable defined in the shell?

I know it's possible to run SQLPLUS through a shell script if Oracle is installed on the machine but what I want to do is to assign a value to a variable while at the SQL prompt.

Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: Mukesh Kesharwani
Date: November 25, 2005 at 03:22:31 Pacific
Reply:

Yes thats verz well possible. Use sql execution in following manner.

sqlplus /nolog << END_SQL

connect $OPR_USER/$OPR_PASS

@db_changes.sql
exit

END_SQL


And you can put ur command in db_changes.sql which is generate in the script itself with all the variable values. Hope its not required to explain how u have to create this sql script.

Or if u have to call one or two sql command then u can directly in between "connect $OPR_USER/$OPR_PASS" and exit .

trust this will help u . :)

Mukesh Kesharwani
CISSP, CCNA, SCSA,CUA,CNA, MCSE,MCP+I,CCNSE,Certified HIPPA Security

http://www.keekar.com


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Solaris Forum Home


Sponsored links

Ads by Google


Results for: Assign value to local variable

problems when copying mini root to local www.computing.net/answers/solaris/problems-when-copying-mini-root-to-local/1422.html

Awk script www.computing.net/answers/solaris/awk-script/2590.html

variable not exporting during boot! www.computing.net/answers/solaris/variable-not-exporting-during-boot/3221.html