I came across the need to define the first day of next month based on the current systemdate. I can do this using the following code:
But the I remembered that there was a post on the oracledeveloper.nl forum with similar date functions.
First day of the week: select trunc(sysdate,’IW’) the_date from dual;
First day of the month: select trunc(sysdate,’MM’) the_date from dual;
First day of the year: select trunc(sysdate,’IY’) the_date from dual;
Using this information the above code could be rewritten to:
A lot shorter and I think also better, because you don’t have to do with date masks etc.