Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

writeappend issue when data is more than 32K

user8195117Jan 20 2022

Hi All,
I have some xml fragments generated by a PLSQL program into clob datatype and the below program throws error.
When the data is more than 32K.. the writeappend is throwing error.
Please help

l_stmt1 VARCHAR2 (32767);
l_clob CLOB;
BEGIN
l_clob := EMPTY_CLOB;
DBMS_LOB.createtemporary (l_clob, TRUE);
DBMS_LOB.OPEN (l_clob, DBMS_LOB.lob_readwrite);
OPEN cur1;
LOOP
BEGIN
-- some sql that generates data

  DBMS\_OUTPUT.put\_line (l\_stmt1);  
     
  EXECUTE IMMEDIATE l\_stmt1  
    INTO l\_clob;  

  DBMS\_OUTPUT.put\_line (DBMS\_LOB.getlength (l\_clob));  

Each of these sqls generate this much of data as per getlength
1st set := 38957K
2nd set := 38977K
3rd set := 35950K
4th set := 651
DBMS_LOB.writeappend (l_clob, LENGTH (l_clob), l_clob);
-- But the Writeappend throws ORA-06502: PL/SQL: numeric or value error
END;
END LOOP cur1;

CLOSE cur1;
END;

Is there a way... we can append xml as we append clob

Comments
Post Details
Added on Jan 20 2022
7 comments
856 views