Last_day & Next_day
Why does the top one work yet the bottom one doesen't?
SELECT LAST_DAY(TO_DATE(Add_months(SYSDATE, -1))) FROM dual
SELECT NEXT_DAY(TO_DATE(Add_months(SYSDATE, -3))) FROM dual
basically i want to be able to find the first date of a given month given the current date.
You need to check the manuals to see how NEXT_DAY function works - it doesn't work like you currently think it does!
As for getting the first day of the month for a given date, one (of the many) method is:
SELECT TRUNC(:date,'MM') FROM dual;
ASCII a stupid question, get a stupid ANSI
24 hours in a day .... 24 beer in a case .... coincidence?
Also, the TO_DATE() function is redundant in your code.
Click Here to Expand Forum to Full Width