Solved

I want to send an email, the output of a simple SQL query in oracle 10g

Posted on 2011-03-04
5
328 Views
Last Modified: 2013-12-19
I want to send an email, the output of a simple SQL query in oracle 10g
0
Comment
Question by:pegahelpdesk1
  • 3
5 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35036868
simple:
I would use UTL_MAIL:

http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_mail.htm

If the message is larger than 32K, you'll need to use UTL_SMTP.
0
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35036885
0
 

Author Comment

by:pegahelpdesk1
ID: 35036976
I am planning to store the output of a query into a text file, and then send using bmail, I will use task scheduler to initiate the batch file where all the commands would be written, so can you tell me how to store output of a query into a text file?
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 35037024
Not sure why you want to involve the operating system and extra files when you don't need to but OK:

In sqlplus use the SPOOL command.  There are a lot of sqlplus options you can set and you can actually create very nice reports.


The basic commands go like:
spool myFile.txt
select ... from table;
spool off

If you want more detailed advice on how to use sqlplus and create a specific format, ask.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now