ORA-06502 PL/SQL: numeric or value error: character to number conversion error;

StackOverflow https://stackoverflow.com/questions/23545386

  •  18-07-2023
  •  | 
  •  

سؤال

In function I have got ORA-06502 error on this line:

newlist := LTRIM(RTRIM(newlist)) + ',';

CREATE OR REPLACE FUNCTION String_To_Int_Table
(
         list VARCHAR2
       , delimiter NCHAR DEFAULT ',' 
)
RETURN t_nested_table
AS

   value VARCHAR(11);
   position INT;
   newlist varchar2(4096);
   tableList t_nested_table;
...
newlist := list;
newlist := LTRIM(RTRIM(newlist)) + ',';

I don't see any conversion problem here. /totally confused/

هل كانت مفيدة؟

المحلول

the string concatenation operator in oracle is ||, not +.

The bytecode compiler tries to auto-convert the varchar2 operands of the sum to numbers and predictably fails.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top