Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-04
5
Medium Priority
?
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 77

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 77

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 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

596 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