当我运行以下查询:LISTAGG功能和ORA-01489:字符串连接的结果是太长
Select
tm.product_id,
listagg(tm.book_id || '(' || tm.score || ')',',')
within group (order by tm.product_id) as matches
from
tl_product_match tm
where
tm.book_id is not null
group by
tm.product_id
Oracle返回以下错误:
ORA-01489: result of string concatenation is too long
我知道原因,失败的原因是listagg函数试图连接大于4000个不支持的字符值。
我已经看到了这里描述的替代示例 - http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php,但它们都需要使用函数或过程。
是否有一种解决方案是纯SQL,无需调用函数或存储过程,并且可以使用标准JDBC读取值?
我遇到的另一个困难是我看到的大多数字符串聚合示例都显示了如何按照原样读取值的示例。在我的示例中,我首先修改了值(即,我正在汇总两列)。
对我来说,任何这些解决方案都不支持返回'CLOB'而不需要创建任何PL/SQL对象。您认为该页面上的哪个选项符合这两个标准? – 2013-02-13 22:21:20