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

I want to send an email, the output of a simple SQL query in oracle 10g
pegahelpdesk1Asked:
Who is Participating?
 
slightwv (䄆 Netminder)Connect With a Mentor Commented:
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
 
slightwv (䄆 Netminder) Commented:
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
 
slightwv (䄆 Netminder) Commented:
0
 
pegahelpdesk1Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.