Computing.Net > Forums > Unix > How to write a sql query in a shell

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.

How to write a sql query in a shell

Reply to Message Icon

Name: daniel624
Date: February 19, 2008 at 10:28:24 Pacific
OS: unix
CPU/Ram: 2gb
Product: hp
Comment:

I want to write a query in shell that retrieves the users from a user table in oracle and then send an email to the user list output. How can i do that in shell script. any idea?




Sponsored Link
Ads by Google

Response Number 1
Name: James Boothe
Date: February 19, 2008 at 14:20:55 Pacific
Reply:

The following just worked for me:

addresslist=$(sqlplus -s scott/tiger << !
set pagesize 0
set feedback off
select email_address
from my_table
where email_address is not null
/
exit
!)

sendmail $addresslist < my.msg


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 Unix Forum Home


Sponsored links

Ads by Google


Results for: How to write a sql query in a shell

how to write a shellscript sleep www.computing.net/answers/unix/how-to-write-a-shellscript-sleep/5528.html

How to write a Infrared driver www.computing.net/answers/unix/how-to-write-a-infrared-driver/813.html

how to write backup scripting www.computing.net/answers/unix/how-to-write-backup-scripting/3099.html