ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06502: PL/SQL: numeric or value error: character string buffer too small sql sql

ORA-06502: PL/SQL: numeric or value error: character string buffer too small


PL/SQL: numeric or value error: character string buffer too small

is due to the fact that you declare a string to be of a fixed length (say 20), and at some point in your code you assign it a value whose length exceeds what you declared.

for example:

myString VARCHAR2(20);myString :='abcdefghijklmnopqrstuvwxyz'; --length 26

will fire such an error


CHAR is a fixed-length data type that uses as much space as possible. So a:= a||'one '; will require more space than is available. Your problem can be reduced to the following example:

declare  v_foo char(50);begin  v_foo := 'A';  dbms_output.put_line('length of v_foo(A) = ' || length(v_foo));  -- next line will raise:  -- ORA-06502: PL/SQL: numeric or value error: character string buffer too small  v_foo := v_foo || 'B';  dbms_output.put_line('length of v_foo(AB) = ' || length(v_foo));  end;/

Never use char. For rationale check the following question (read also the links):


This may also happen if you have a faulty or accidental equation in your csv file.i.e - One of the cells in your csv file starts with an equals sign (=) (An excel equation) which will, in turn throw an error.If you fix, or remove this equation by getting rid of the equals sign, it should solve the ORA-06502 error.