我在下面运行这个查询,并返回以下消息:查询返回-> ORA-19011:字符串缓冲区太小当我取消对最后一行的注释时,它可以工作。我认为这就是为什么这只会带来很少的结果。如何解决这个问题?
select substr(xmlagg(xmlelement (e, str||',')).extract ('//text()'),1,(Length(Trim(xmlagg (xmlelement (e, str||',')).extract ('//text()')))-2)) motivos
FROM (
select to_char(lo_valor) str
from editor_layout el,
editor_versao_documento ev,
editor_documento ed,
editor_layout_campo elc,
editor_campo ec,
editor_registro er,
editor_registro_campo erc,
pw_editor_clinico pec,
pw_documento_clinico pdc
where pec.cd_editor_registro = er.cd_registro
and pdc.cd_documento_clinico = pec.cd_documento_clinico
and ed.cd_documento = ev.cd_documento
and el.cd_versao_documento = ev.cd_versao_documento
and el.cd_layout = elc.cd_layout
and elc.cd_campo = ec.cd_campo
and elc.cd_campo = erc.cd_campo
and er.cd_registro = erc.cd_registro
and er.cd_layout = el.cd_layout
and ec.ds_identificador = 'nut_orientacoes_entregues_1'
AND To_Char(lo_valor) IS NOT null
--and Trunc(pdc.dh_documento) BETWEEN Trunc(SYSDATE-5) AND Trunc(SYSDATE)
)发布于 2014-12-16 13:49:16
xmlagg(xmlelement ...)调用的内容返回一个clob,并且您正在尝试将其填充到varchar2中,因为您调用了substr。如果clob太大,这将失败。
当您取消注释最后一行时,它将失败的原因是,在该范围之外,有一些内容太长的行。
https://stackoverflow.com/questions/27506028
复制相似问题