# Automate Weekly Report

**URL:** <https://forums.toadworld.com/t/automate-weekly-report/10378>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [April 12, 2011, 7:50am UTC](https://forums.toadworld.com/t/automate-weekly-report/10378 "2011-04-12T07:50:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkatakam\_328](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@kkatakam\_328](https://forums.toadworld.com/u/kkatakam_328)\
**Post date:** [April 12, 2011, 7:50am UTC](https://forums.toadworld.com/t/automate-weekly-report/10378/1 "2011-04-12T07:50:01Z")

</div>

Hello,

i have requirement to automate weekly report with the records of a particular table data with certain conditions. Then i have to write dbms\_scheduler to call this procedure to generate the report and send to the appropriate persons.

I wrote a query as follows:

select sid, TO\_char(date\_in\_class,‘MM-DD-YYYY’)

from test

where sid in(‘ST1234’,‘ST5678’)

and date\_in between to\_date(‘04/03/2011’,‘mm/dd/yyyy’) and to\_date(‘04/09/2011’,‘mm/dd/yyyy’);

i would like to put this in a procedure and use the date\_in as the start and end dates for the week, which should automatically get the weekly dates based on the week i.e. Typical Sunday to Saturday week calculation.

Can someone please shed some light how to accomplish this?
