Oracle; dates- looking for previous month

Hi Experts
I have this statement
select
(case to_char(trunc(sysdate,'mm'),'d') when '7' then trunc(sysdate,'mm')+2 when '1' then trunc(sysdate,'mm')+1 else trunc(sysdate,'mm') end) NEWDATE
from dual

That brings me back to the first business day of the month however  I want to add something to this that would bring me back to the first business day of the PREVIOUS month when May 1st rolls around- or any new month actually.
So when May 1st comes- and sysdate is may 1st, I want this sql to be able to go back to April 3rd, which is the first business day of April.  The same would apply for June, when June 1st comes around- i want this sql to bring the date back to May 1st which would be the first busness day of that month.
MY end in mind is to create something that I can add to scripts that I have running in oracle that would allow me to schedule them so that I do not have to change the date every new month.

thanks
~jw~

LVL 1
jaw1971Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RainMan82Commented:
select
(case to_char(trunc(add_months(sysdate,-1),'mm'),'d') when '7' then trunc(add_months(sysdate,-1),'mm')+2 when '1' then trunc(add_months(sysdate,-1),'mm')+1 else trunc(add_months(sysdate,-1),'mm') end) NEWDATE
from dual

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Harish_RajaniCommented:
Use the add month function

Try
select trunc( add_months(sysdate, -1), 'MM') from dual.

This will give you the idea..

Then replace all sysdates in your query with addmonths(sysdate, -1).

Rgds,
HR
jaw1971Author Commented:
Rainman82
thanks- this is what I wanted
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.