Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATE IN A CURSOR

Status
Not open for further replies.

016

Programmer
May 8, 2000
17
0
0
US
i am writing a cursor and I want to give certain information because, for example the budget year 2000 is from november 1 2000 to october 31 2001. If i am considering the budget year 2000, I want to say if order_1 is done between november 1 and december 31, the budget year is 2000 and if it dated between january 1 and october 31 i have to have 2001, if i am considering the budget year for 1999, and the order_1 is between novemebr and december, it will be 1998 for, january to octber it will be the budget year 1999.
Could you help, please by the way the budget year datatype in number (4)
thank you
 
You may write some decode expression, but IMHO the best way is to write your own function, returning what you need. It will be quite simple. You may also create small table (budget calendar) to use it in the function mentioned above or directly in selects.
 
HI, SEM. tHANK YOU FOR YOUR SUGGESTION, BUT COULD YOU HELP ME WITH SELECT CODE, PLEASE. THANKS
 
I the budget year starts on November 1 you may write (assuming pdate is date parameter):
select to_char(pdate + 61, 'yyyy') from dual.
The dummy number 61 is time in days from November 1 to the next year. If every budget year starts on different date, try to use decode(sign(pdate - year1_start),1,year1, ... and so on.
 
sem

Thank you very much, I will try and keep you informed.
 
thank you, sem.it was helpful.
kyal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top