Search code examples
sqlexcelplsqlexportplsqldeveloper

Send result of query over email in PL/SQL Developer


I am not quite sure on what is the easiest and fastest way to send a query result over email in PL/SQL Developer. I have a big PL/SQL package which is doing a lot of stuff, but lets keep it simple. In between the whole logic I am doing:

insert into animals...

Now I want all records which have been inserted into the animals table to be sent over email. For example:

select * from animals where timestamp_loading > sysdate - 1/24        
-- now export this result and send over email

It could be via Excel file or just line by line written into an email.

Does anybody know any good function in PL/SQL Developer on how to do this? I've seen that there is some sort of utl_mail Package which I could use.


Solution

  • take a look at Vsql-email app (you can search on google, I think I'm not allowed to post the direct link here), you can send the email as HTML formatted body and/or as an excel attachment, and no need to enable and configure Database Mail in SQL Server and write code for HTML formatting.