【发布时间】:2019-05-11 13:20:33
【问题描述】:
我正在尝试使用 xmlagg 聚合字符串,但我遇到了错误。这是 xmlagg
select
apex_string.format(t1.col_heading, null, null, 1, 2, null)
|| rtrim(xmlagg(XMLELEMENT(e,apex_string.format(t2.col_heading, null, null, da.n_service, case da.gid when 15 then 3 else 1 end, coalesce(da.service_type, 'Grand Total')),'').EXTRACT('//text()') order by da.c ).GetClobVal(),',')
, min(da.gid)
from
data_aggs da
cross join std_template t1
cross join std_template t2
where
da.balance_type is null
and da.gid in (11, 15)
group by
t1.col_heading
当我运行这个时,我发现下面的错误
[Error] Execution (132: 14): ORA-01790: expression must have same datatype as corresponding expression
【问题讨论】:
-
DA.GID的数据类型是什么? -
它的字符类型
-
然后 - 在 CASE 中 - 将其与字符串而不是数字进行比较
-
你能举个例子吗
-
当然;我发了,看看希望它会有所帮助。
标签: sql oracle string-aggregation