For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.
Please review the specific download instructions here.
SQL> select case when extract(month from sysdate) between 1 and 9 then add_months(trunc(sysdate,'year'),-3) 2 else add_months(trunc(sysdate,'year'),9) 3 end 4 as dt 5 from dual 6 / DT --------- 01-OCT-08
ADD_MONTHS ( TRUNC ( ADD_MONTHS ( dt , 3 ) , 'YYYY' ) , -3 )
select column_value, extract(year from add_months(column_value,-9)) as y, add_months(trunc(add_months(column_value,-9),'yyyy'),9) as oct from table(sys.odciDateList( date '2009-01-01',date '2009-09-01', date '2009-10-01',date '2009-12-01')); COLUMN_V Y OCT -------- ---- -------- 09-01-01 2008 08-10-01 09-09-01 2008 08-10-01 09-10-01 2009 09-10-01 09-12-01 2009 09-10-01
SQL> SELECT ADD_MONTHS (TRUNC (SYSDATE, 'year') 2 ,DECODE (GREATEST (9, TO_CHAR (SYSDATE, 'MM')), 9, -3, 10)) dt 3 FROM DUAL; DT --------- 01-OCT-10 SQL>