TRANSLATE在XMLAGG

时间:2015-06-09 15:20:26

标签: sql xml db2

我想使用TRANSLATE替换XMLAGG中使用的字符串中的无效XML字符,而不是嵌套REPLACE,因为需要替换大量字符:< / p>

select c.key,  
  cast( substr( xmlserialize( xmlagg( xmltext( concat( ' | ', 
    replace(replace(replace(replace(c.comment_text,chr(160),' '), chr(191),' '), chr(176),' '), chr(190),' ')
    --translate(c.comment_text, ' ', chr(160)||chr(176)||chr(190)||chr(191))
   ) ) order by c.comment_date desc ) as clob ), 3, 4000 ) as varchar2) as sum_comment
from comments c  
where c.comment_date > current_timestamp - 90
group by c.key

如果我在XMLAGG之外运行,我可以看到TRANSLATEREPLACE都删除了无效字符,但在XMLAGG内我收到了错误我在使用TRANSLATE

时试图避免
An illegal XML character "#xA0" was found in an SQL/XML expression or function argument that begins with string " | A".

0 个答案:

没有答案