Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

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
0
pegahelpdesk1
Asked:
pegahelpdesk1
  • 3
1 Solution
 
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
 
slightwv (䄆 Netminder) 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

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now