roedelfroe
Programmer
Hello everybody,
since our database upgrade from 9i to 10g we have problems with a function. It works fine in 9i, but in 10g we got ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at "AB.P_V_NUMBER".
Following select is used:
SELECT
SUBSTR(DS,1,4) AS YEAR,
SUBSTR(DS,5,2) AS MOTH,
SUBSTR(DS,19,5) AS OEH,
SUBSTR(DS,24,3) AS CANDZ,
SUBSTR(DS,27,1) AS ATYPE,
REPLACE(SUBSTR(US,45,17),'.',',') AS ORIG_DIVPLAN,
AB.P_V_NUMBER(REPLACE(SUBSTR(US,45,17),'.',',')) AS DIVPLAN,
REPLACE(SUBSTR(US,28,17),'.',',') AS ORIG_DIVIST,
AB.P_V_NUMBER(REPLACE(SUBSTR(US,28,17),'.',',')) AS DIVIST FROM AB.IMPORTTB WHERE
SUBSTR(DS,7,2) = '03' AND
SUBSTR(DS,1,4) = '2008' AND
SUBSTR(DS,5,2) = '03'
order by 3,4,5;
Function AB.P_V_NUMBER is as follows:
FUNCTION P_V_NUMBER (P_NUMBER IN VARCHAR2
) return number
IS
L_DECTRENNER CHAR(1) DEFAULT '.';
L_NUMBER VARCHAR2(30);
begin
L_NUMBER := REPLACE(P_NUMBER,'.',L_DECTRENNER);
L_NUMBER := REPLACE(L_NUMBER,',',L_DECTRENNER);
return to_number(L_NUMBER);
end;
A sample input string: +000014059750,000 (ORIG_DIVPLAN)
Should be returned as : 14059750 (DIVPLAN)
Of course i've checked the language parameters, they are the same in 9i and 10g.
Any hints?
Thanks a lot in advance
Roland
since our database upgrade from 9i to 10g we have problems with a function. It works fine in 9i, but in 10g we got ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at "AB.P_V_NUMBER".
Following select is used:
SELECT
SUBSTR(DS,1,4) AS YEAR,
SUBSTR(DS,5,2) AS MOTH,
SUBSTR(DS,19,5) AS OEH,
SUBSTR(DS,24,3) AS CANDZ,
SUBSTR(DS,27,1) AS ATYPE,
REPLACE(SUBSTR(US,45,17),'.',',') AS ORIG_DIVPLAN,
AB.P_V_NUMBER(REPLACE(SUBSTR(US,45,17),'.',',')) AS DIVPLAN,
REPLACE(SUBSTR(US,28,17),'.',',') AS ORIG_DIVIST,
AB.P_V_NUMBER(REPLACE(SUBSTR(US,28,17),'.',',')) AS DIVIST FROM AB.IMPORTTB WHERE
SUBSTR(DS,7,2) = '03' AND
SUBSTR(DS,1,4) = '2008' AND
SUBSTR(DS,5,2) = '03'
order by 3,4,5;
Function AB.P_V_NUMBER is as follows:
FUNCTION P_V_NUMBER (P_NUMBER IN VARCHAR2
) return number
IS
L_DECTRENNER CHAR(1) DEFAULT '.';
L_NUMBER VARCHAR2(30);
begin
L_NUMBER := REPLACE(P_NUMBER,'.',L_DECTRENNER);
L_NUMBER := REPLACE(L_NUMBER,',',L_DECTRENNER);
return to_number(L_NUMBER);
end;
A sample input string: +000014059750,000 (ORIG_DIVPLAN)
Should be returned as : 14059750 (DIVPLAN)
Of course i've checked the language parameters, they are the same in 9i and 10g.
Any hints?
Thanks a lot in advance
Roland