- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Store DB value
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:07 AM
06-16-2003 09:07 AM
Store DB value
in middle of my script, i need to check value of a
column in database table and depends on the value i need to
proceed with my shell script process....
for eg...
Myshell.sh
...
..
...
...
Sqlplus .... check.sql (helps to fetch value from database and store it in Local_Var)
If Local_Var = 'A'
Do 'Task A'
Elsif Local_Var = 'B'
Do 'Task B'
fi.
******* How to store database column value in Local_Var ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:14 AM
06-16-2003 09:14 AM
Re: Store DB value
Local_Var=`sqlplus .... check.sql`
Note that the quotes are back-quotes.
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:20 AM
06-16-2003 09:20 AM
Re: Store DB value
You can also store/write/redirect the value in a temp file and access the value from there in your shell script.
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:32 AM
06-16-2003 09:32 AM
Re: Store DB value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2003 09:54 AM
06-16-2003 09:54 AM
Re: Store DB value
The shell script understand its own environment. The sql file you create can be understood and executed only by database clients which is a different process altogether.
You can do, provided the sqlplus shoud write to stdout and you can grep/cut/awk that output to get the exact value in the local_var like previously mentioned.
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2003 07:56 AM
06-17-2003 07:56 AM
Re: Store DB value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2003 08:08 AM
06-17-2003 08:08 AM
Re: Store DB value
I dont work in Oracle. But I work in Informix. Follwing is a sql file which selects a value from a table.
$ cat mytemp.sql
select field1 from table_a where field2=1111;
Here is the part of shell script which actually does the job.
$ mytemp.sh
local_var=`dbaccess db1 mytemp.sql`
next_var=`echo $local_var|awk '{ print $2 }'`
echo "here from the shell" $next_var
where dbaccess is the equivalent of sqlplus.
HTH,
Umapathy