| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: Finding first saturday of month
"Mark D Powell" <Mark.Powell_at_eds.com> wrote in message
news:2687bb95.0403021110.473851c0_at_posting.google.com...
| I believe the SQL posted earlier may have a problem if the first day
| of the month is a Saturday as my test found the next Saturday in this
| case. (May is the only month in 2004 that starts on a Saturday)
|
| Here is my attempt:
| 1 select next_day(last_day(add_months(sysdate,-1)),'Saturday')
| 2* from dual
| @UT1 SQL>> /
|
| NEXT_DAY(
| ---------
| 06-MAR-04
|
| 1 row selected.
|
| If you substitute any date in May for sysdate it still produces
| Saturday 1-May as the result.
|
| HTH -- Mark D Powell --
good solution
here's the one that i thought i had posted earlier and never did:
select next_day(trunc(sysdate,'MM')-1,'sat') first_sat from dual
which skins the same cat but with one less function; it also works for may:
;-{ mcs Received on Tue Mar 02 2004 - 17:07:05 CST
![]() |
![]() |