How to get first day of the month in Oracle

 In Oracle, getting the first day of the month is very simple 


✅ Basic Query

SELECT TRUNC(SYSDATE, 'MM') FROM dual;

🔎 Explanation

  • TRUNC(date, 'MM') → returns 1st day of that month

  • Time will be 00:00:00


🧪 Examples

🔹 Current month first day

SELECT TRUNC(SYSDATE, 'MM') FROM dual;

🔹 For a specific date

SELECT TRUNC(TO_DATE('24-MAR-2026','DD-MON-YYYY'), 'MM')
FROM dual;

👉 Output: 01-MAR-2026


✅ First day of previous month

SELECT TRUNC(ADD_MONTHS(SYSDATE, -1), 'MM') FROM dual;

✅ First day of next month

SELECT TRUNC(ADD_MONTHS(SYSDATE, 1), 'MM') FROM dual;

🚀 Usage in WHERE clause

WHERE some_date >= TRUNC(SYSDATE, 'MM')


Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post