REP-1401 ORA-06502: PL/SQL: numeric or value error [message #627615] |
Thu, 13 November 2014 02:45 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi all,
FUNCTION Cf_10formula
RETURN NUMBER
IS
BEGIN
SELECT Nvl(Round(SUM(amount)), 0)
INTO :CP_5
FROM hhxw_region_col_v
WHERE category IN ( 'Intercompany - CATV' )
AND Trunc(gl_date) BETWEEN To_date(:P_FROM_DATE, 'DD/MM/RRRR') AND
To_date( :P_TO_DATE, 'DD/MM/RRRR');
RETURN :CP_5;
END;
But here I was getting amount 40000. But I want the amount to be displayed 40,000 . So to achieve this i make some changes in my Formula column query , and for this am getting error.
MSG-00187: From Date 01-Sep-2014
REP-1401: 'cf_10formula': Fatal PL/SQL error occurred.
ORA-06502: PL/SQL: numeric or value error
1. I have manually increased the size of formula column to 50. Initially it was 10. datatype is number.
2. The max length of amount is 13. I have taken this from the base table.
Placeholder is having 30 width & datatype is number.
So based on this data, please let me know whether i am on right track or not ?
Please help me on this
Thanks
|
|
|
Re: REP-1401 ORA-06502: PL/SQL: numeric or value error [message #627617 is a reply to message #627615] |
Thu, 13 November 2014 03:06 |
cookiemonster
Messages: 13958 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If you've got a number function returning into a number field then all you should need to do to make the comma appear is to change the number format mask in field.
However, Why are you selecting the value into a report item? Select into a local variable and return that.
And you should avoid applying functions to DB columns in where clauses wherever possible, so oracle can use indexes on them if applicable:
AND gl_date >= To_date(:P_FROM_DATE, 'DD/MM/RRRR')
AND gl_date < To_date( :P_TO_DATE, 'DD/MM/RRRR') + 1;
|
|
|
|
Re: REP-1401 ORA-06502: PL/SQL: numeric or value error [message #627619 is a reply to message #627618] |
Thu, 13 November 2014 04:03 |
cookiemonster
Messages: 13958 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
mist598 wrote on Thu, 13 November 2014 09:19
Quote:you should avoid applying functions to DB columns in where clauses wherever possible, so oracle can use indexes on them if applicable:
Can you please explain more on this? I am not getting your point.
If there's an index on gl_Date then oracle will not use it if you apply a function (like trunk) to gl_date in the where clause.
mist598 wrote on Thu, 13 November 2014 09:19
And i have another doubt suppose local variable is v_amount and assigned into the Place Holder column like below
:CP_5 := nvl(trunc(v_amount),0);
So can i use in the return like below
Probably, give it a try.
|
|
|
|
|
|