你似乎没有做错什么。使用虚拟表函数返回您显示的数据,wm_concat
对我有用:
select wm_concat(object_id) from
(select object_id from cr_object_group_entries_vw where object_group_id in
(select item from table(cr_fn_split_string('28,56',','))))
/
WM_CONCAT(OBJECT_ID)
--------------------------------------------------------------------------------
36,1,11,121,13,14,17,18,2,24,3,32,33,34,35,36,37,38,39,40,42,43,44,6,7,8,81
您已将问题标记为 [11g];正如@beherenow 所说,如果可以的话,您应该使用 supportedlisgagg
而非 unsupported wm_concat
,尽管我认为它仅适用于 11gR2:
select listagg(object_id, ',') within group (order by object_id)
from cr_object_group_entries_vw
where object_group_id in
(select item from table(cr_fn_split_string('28,56',',')))
/
LISTAGG(OBJECT_ID,',')WITHINGROUP(ORDERBYOBJECT_ID)
---------------------------------------------------------------------------
1,11,121,13,14,17,18,2,24,3,32,33,34,35,36,36,37,38,39,40,42,43,44,6,7,8,81
SQL Fiddle(listagg
仅限,因为它不支持wm_concat
- 也许您的实例也不支持,但它应该出错?)