MONTHS_BETWEEN problem in Oracle Form 6i [message #605151] |
Tue, 07 January 2014 11:43 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/178896.jpg) |
dark_prince
Messages: 121 Registered: June 2013 Location: India
|
Senior Member |
|
|
I used following coding in form to find the months between
BEGIN
:FINANCED_DETAILS.due_date := TO_CHAR(:FINANCED_DETAILS.emi_end_dt, 'ddth') || ' OF MONTH';
:FINANCED_DETAILS.fin_tenure := MONTHS_BETWEEN (:FINANCED_DETAILS.emi_end_dt, :FINANCED_DETAILS.emi_start_dt) || ' MONTHS';
END;
If i am giving input
emi_end_dt = '07-jan-2017' and
emi_start_dt = '07-jan-2014' its working fine and giving output 36 months
But If i giving input
emi_end_dt = '31-mar-2014' and
emi_start_dt = '01-feb-2016' its not giving output but giving me error ORA-06502
Can anyone tell me how to solved this
|
|
|
|
|
Re: MONTHS_BETWEEN problem in Oracle Form 6i [message #605170 is a reply to message #605159] |
Tue, 07 January 2014 14:12 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
dark_prince wrote on Tue, 07 January 2014 23:37emi_start_dt & emi_end_dt are DATE columns And others are VARCHAR2(30)
What is data type of fin_tenure?
MONTHS_BETWEEN returns the NUMBER of months. So, if you assign number to a character type you would get ORA-06502.
|
|
|
|
|
|
|
Re: MONTHS_BETWEEN problem in Oracle Form 6i [message #605178 is a reply to message #605151] |
Tue, 07 January 2014 14:29 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
As LF already said the negative value might be an issue, I suspect the problem might be the input values. The end date being less than the start sate. @OP, is it a typo?
dark_prince wrote on Tue, 07 January 2014 23:13
But If i giving input
emi_end_dt = '31-mar-2014' and
emi_start_dt = '01-feb-2016' its not giving output but giving me error ORA-06502
|
|
|
|
|
|
|
|