Link to home
Start Free TrialLog in
Avatar of saved4use
saved4useFlag for United States of America

asked on

ORACLE previous week date function

I'd like to create a report which will run every Monday morning showing data for the previous week; Sun - Sat.

CLOSED_DTTM > trunc(SYSDATE)- 7 is not working.

What should I use?

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of flow01
flow01
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of saved4use

ASKER

Will the above work even when, say,  the middle of the week is a new month?
yes author, the solution which flow01 will work fine even in case the middle of week is a new month...

what in actual it does it, it truncates the day to start of the week,..

for example 01/Mar/2012 is thursday,

select trunc(to_date('01-Mar-2012','DD-Mon-YYYY'),'WW') from dual

this will result in 26th Feb 2012, which is start of the week and by default the start of week in oracle is sunday..