Skip to Main Content

SQL & PL/SQL

Announcement

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!

SQL to convert a date column to a FISCAL Year, Qtr, month and week

Ryansun-OracleSep 5 2012 — edited Sep 5 2012
Hi There,

We have a table which has some Sales data and stores a Sales date. I have a requirement where we need to convert the sales date (which is the Calendar date) to the Fiscal Year, Quarter and Month. The Fiscal year will be starts from June 1st. Does anyone have an idea how this can be done. The regular to_char(), MM, QTR, Year and week will return the regular Quarter.

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
salesid      col1

id1         26-JUN-2012
id2         25-MAR-2012
id3         22-JUL-2012
.
.
.



output should be col1 corresponding 
id1, Fiscal Month, Fiscal Year, Fiscal Qtr, Fiscal Week considering Fiscal year starts from Jun 1st
Thanks,
Sunil
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2012
Added on Sep 5 2012
4 comments
5,626 views