Determine first day of the quarter [message #18642] |
Fri, 08 February 2002 05:57  |
mary
Messages: 19 Registered: November 1999
|
Junior Member |
|
|
I would like to know how to write a sql statement which can be embedded in pl/sql package to determine the first day of the quarter. eg I want to do some maintenace but I would like to do it every three months. So I need to determine if the begining of the new quarter to do the maintenance... thanks in advance
|
|
|
Re: Determine first day of the quarter [message #18644 is a reply to message #18642] |
Fri, 08 February 2002 06:26   |
Jon
Messages: 483 Registered: May 2001
|
Senior Member |
|
|
There are probably more elegant ways of doing it, but if the following returns 'Yes', it is the first day of the quarter:
select decode(trunc(sysdate)-trunc(last_day(sysdate-1)),1,'Yes','No') FirstDayOfQtr
from dual
where to_char(sysdate,'MM') in ('04','07','10','01')
|
|
|
|
|