using sysdate in an Oracle query

Experts,

Does anyone know the syntax in Oracle to find a date?

Examples:
the first day of the current month
The first day of the current week
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
sdstuberConnect With a Mentor Commented:
select trunc(sysdate,'mm') from dual -- first day of month


select trunc(sysdate,'dy') from dual -- first day of week


week start/end is dependent on NLS calendar settings
0
 
SharathConnect With a Mentor Data EngineerCommented:
SELECT TRUNC(SYSDATE, 'MM') First_Day_Of_Month,
         TRUNC(TO_DATE(SYSDATE),'D') First_Day_Of_Week
 FROM dual;
0
 
sdstuberCommented:
TO_DATE(SYSDATE)

don't do TO_DATE() on SYSDATE, it's already a date

  just put the TRUNC directly against the sysdate result as shown in the first post
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.