Home » SQL & PL/SQL » SQL & PL/SQL » FISCAL YEAR date format
FISCAL YEAR date format [message #20628] Sun, 09 June 2002 11:20 Go to next message
ramesh
Messages: 123
Registered: August 2000
Senior Member
I've designed a report that prompts the user to enter a full date (mm/dd/yyyy) for the parameter. The report needs to select records with open dates through the parameter date for the fiscal year period (OCT-SEP). For example, when the user enters CURRENT MONTH JUNE 06/09/2002, the report needs to select records opened from last year 2001 OCT through current year PREVOIUS MONTH MAY 2002 . I should get last 12 months results ...suppose if i enter NOV it should give me only OCT month.Please help with the selection.
Re: FISCAL YEAR date format [message #20685 is a reply to message #20628] Thu, 13 June 2002 13:27 Go to previous message
Sanjay Bajracharya
Messages: 279
Registered: October 2001
Location: Florida
Senior Member
Need to us PL/SQL for this

Input: mm/dd/yyyy (as you said)

if mm <= 10
date between 10/(yyyy-1) and (mm -1)/yyyy
else
date between 10/yyyy and (mm - 1)/yyyy
end if

eg
mm/dd/yyyy = 06/09/2002
date between 10/(2002-1) and (6-1)/2002

mm/dd/yyyy = 11/01/2002
date between 10/2002 and (11-1)/2002

(something you have not mentioned, but a good test)
mm/dd/yyyy = 10/01/2002 ??
date between 10/(2002-1) and (10-1)/2002

Good luck.
Previous Topic: using SUBSTR function in an outer join?
Next Topic: Tuning a sql statement
Goto Forum:
  


Current Time: Thu Apr 25 22:35:37 CDT 2024