Skip to Main Content

Oracle Database Discussions

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

ORA-01706: user function result value was too large with XMLTABLE

DENISKA80Nov 20 2024

Hi there

--create test table
create table test_vatchar2_clob (v2 varchar2 (4000), c clob);
--pl/sql block
declare
 v_clob clob;
 v_xmltype xmltype;
 v_varchar2 varchar2(32000);
begin
 v_clob:='<Root>';
 
 for i in 1..2000 loop
   v_clob:=v_clob||'<c>'||I||'</c>';
 end loop;
 
 v_clob:=v_clob||'</Root>';
 
 select xmltype(v_clob) into v_xmltype from dual;
 delete test_vatchar2_clob;
 
 insert into test_vatchar2_clob(v2, c)
 select v2,c 
        FROM   (SELECT v_xmltype Xm
             FROM   dual) a,
            Xmltable('Root' Passing a.Xm Columns c clob Path
                     'string-join(c,";")',
                     v2 varchar2(4000) Path
                     'substring(string-join(c,";"),1,4000)'
                     );
commit;                      
end;

--execute and get error ORA-01706

--change this

'substring(string-join(c,";"),1,4000)'

for

'substring(string-join(c,";"),1,3999)'

and it works

What happens to one character?

Comments
Post Details
Added on Nov 20 2024
3 comments
52 views