saved4use
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.
CLOSED_DTTM > trunc(SYSDATE)- 7 is not working.
What should I use?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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..
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
this will result in 26th Feb 2012, which is start of the week and by default the start of week in oracle is sunday..
ASKER