Skip to Main Content
  • Questions
  • Sending Table output as an attachment in .csv on 3rd of every month through Outlook

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Rohit.

Asked: July 04, 2019 - 12:27 pm UTC

Last updated: July 05, 2019 - 6:20 am UTC

Version: 18.4.0.376

Viewed 1000+ times

You Asked

Hi,

Currently we have a table in SQL developer Oracle whose output we export in csv and send to the stakeholder though outlook. This is a monthly deliverable and is 100 percent manual.

Is there a way to schedule this table output on a monthly basis and send the outlook email with csv attachment.

You support will save lots of time at our end and the solution if it exists can free us for other work.


Thanks,
Rohit Joshi
Wolters Kluwer

and Connor said...

Take a look at this question

https://asktom.oracle.com/pls/apex/asktom.search?tag=guidance-on-utl-smtp

It has a routine to send html formatted email, but basically describes how to "carve" an email into a message and an associated attachment using data from the database.

Once you have it running as a procedure, then you can use the scheduler to automate that, eg

    dbms_scheduler.create_job (
       job_name           =>  'MY_CSV_EMAILER',
       job_type           =>  'PLSQL_BLOCK',
       job_action         =>  'begin my_procedure; end;',
       start_date         =>  sysdate,
       repeat_interval    =>  'FREQ=MONTHLY',
       enabled            =>  true);



Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library