在我的存储过程中:
declare
v_xml xmltype;
begin
open v_cur for
Select xmlelement('el',xmlagg(xmlelement('el2'))) from table;
loop
fetch v_cur into v_xml; -- line where the error
*.....additional logic to parse v_xml*
end loop;
end;
当要提取到 v_xml 中的记录长度 > 4000 时,我收到“字符串缓冲区太小”错误。你们知道如何解决这个问题吗?谢谢
最佳答案
如果您使用 xmlagg()
,则必须将 .getclobval()
添加到周围的 xmlelement()
,因为 char xmlagg()
的限制为 4000。显然,这意味着您将使用 clob 而不是 xmltype,但您别无选择,如果需要,您稍后必须转换回 xmltype。下面的例子:
declare
v_xml clob; -- Use CLOB
begin
open v_cur for
Select xmlelement("el",xmlagg(xmlelement("el2", tab_col))).getclobval() from table; -- add .getclobval()
loop
fetch v_cur into v_xml; -- line where the error
*.....additional logic to parse v_xml*
end loop;
end;
关于oracle - xmltype 字符串缓冲区太小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23027540/