RE: CASE in PL/SQL

2003-07-07 Thread Surendra . Tirumala
Thank you. Surendra -Original Message- Sent: Monday, July 07, 2003 10:19 AM To: Multiple recipients of list ORACLE-L The problem was explained clearly but the context in which it had to be used was obscure. Rajendra Jamadagni had suggested a solution using functions which could be calle

RE: CASE in PL/SQL

2003-07-07 Thread Chelur, Jayadas {PBSG}
The problem was explained clearly but the context in which it had to be used was obscure. Rajendra Jamadagni had suggested a solution using functions which could be called from SQL and you had mentioned that it could NOT be used in a CURSOR (!). The 'simplest' way to calculate the financial quarte

RE: CASE in PL/SQL

2003-07-03 Thread Surendra . Tirumala
Title: RE: CASE in PL/SQL I think I have clearly explained what I am doing/looking for in my original mail. As I have mentioned in one of the replies, I have posted same question in Metalink Forum and they gave me the exact/simple solution I am looking for.   Here is below the conversation

RE: CASE in PL/SQL

2003-07-03 Thread Jamadagni, Rajendra
Title: RE: CASE in PL/SQL Can you at-least _show_ us what you are doing, what you want to do and where the code is failing? We are shooting in the dark here ..   Like I mentioned before, you can _always_ use SQL to assign values to pl/sql variables. Raj

RE: CASE in PL/SQL

2003-07-03 Thread Chelur, Jayadas {PBSG}
Surendra, The following query lists 12 months along with the actual year and quarter as well as the financial year and financial quarter ... probably you can modify this query to use in your cursor ... SELECT CUR_DATE, CUR_YEAR, CUR_QTR, FIN_QTR, LEAST(0,SIGN(CU

RE: CASE in PL/SQL

2003-07-02 Thread Surendra . Tirumala
Title: RE: CASE in PL/SQL I am already using it that way, but giving that condition in cursor is not possible. Thanks for your help. Surendra -Original Message-From: Jamadagni, Rajendra [mailto:[EMAIL PROTECTED]Sent: Wednesday, July 02, 2003 5:01 PMTo: Multiple recipients of

RE: CASE in PL/SQL

2003-07-02 Thread Rudy Zung
I still feel that to_char(add_months(sysdate, 6), 'Q') is a simpler solution than MOD(TO_NUMBER(TO_CHAR(add_months(sysdate,9),'Q'))+1,4) + 1 when determining the fiscal quarter. Also, the latter solution above is off-by-one regarding the results per your original email wherein the fiscal ye

RE: CASE in PL/SQL

2003-07-02 Thread Jamadagni, Rajendra
Title: RE: CASE in PL/SQL just use the sql to assign value to your variable ... if you really want my advise, make this a function or a procedure so you can call it from where ever you want. As function can be completely written in pl/sql you should be okay ... -- this is a procedure

RE: CASE in PL/SQL

2003-07-02 Thread Surendra . Tirumala
Hi George, With this solution you can only find Quarter number. but I also need Year of that quarter number. when you say to_char(date,'Q'), it might go next year or stay in current fiscal year depending on number of months we add to the date. Thanks, Surendra -Original Message- Sent: We

RE: CASE in PL/SQL

2003-07-02 Thread Surendra . Tirumala
Hi Rudy, Thanks for your suggestion. But I got a better suggestion from Metalink. Here what I was suggested: SQL> SELECT (MOD(TO_NUMBER(TO_CHAR(add_months(sysdate,9),'Q'))+1,4) + 1) qtr 2 , DECODE(SIGN(TO_NUMBER(TO_CHAR(main_rec.termination_date,'Q')) - 3) 3 , -1, TO_NUMBER(TO_CHAR(main_rec.ter

RE: CASE in PL/SQL

2003-07-02 Thread Rudy Zung
If your Jul is 1st quarter, then your offset is should be 6 months instead of the 9 months in your email; or think of it another way, if you Jan is the beginning of the 3rd quarter, it is the beginning of the 2nd half of the year, and half a year is 6 months. With this in mind, you really don't n

Re: CASE in PL/SQL

2003-07-02 Thread George Oneata
You don't need CASE. try : to_char( date , 'Q') George > Hello ALL, > > I am trying to find quarter number from a given date . Here is the > description > > Our Financial year runs from July thru June. So, Given any date between > these dates I need to find 3 quarters(9 months) from it. > July

CASE in PL/SQL

2003-07-02 Thread Surendra . Tirumala
Hello ALL, I am trying to find quarter number from a given date . Here is the description Our Financial year runs from July thru June. So, Given any date between these dates I need to find 3 quarters(9 months) from it. July -Sep -> 1st Quarter Oct -Dec -> 2nd Quarter Jan -Mar -> 3rd Qu