Appending a NUMBER to a CLOB Incorrectly Raises ORA-06502 Error (Doc ID 746261.1)

Last updated on JULY 05, 2017

Applies to:

PL/SQL - Version: 10.1.0.2 to 10.2.0.1 - Release: 10.1 to 10.2
Information in this document applies to any platform.

Symptoms

Concatenating a CLOB with a numer in a loop from 1 to 20000, raises the error

ORA-06502 - PL/SQL numeric or value error

DECLARE
 l_input_xml CLOB;
 l_number PLS_INTEGER := 1;

BEGIN
 l_input_xml := ' ';
 FOR i IN 1..20000 LOOP
  l_input_xml := l_input_xml || i;
 END LOOP;
END;
/


Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms