I have a table where one of the columns contains a nested table of single row.
mytable
title | col
a | {1, 2}
b | {3}
c | NULL
What I need to do is flatten the nested table into a comma-separated String.
Result:
{
a: "1, 2"
b: "3"
c: NULL
}
For my specific purpose I can't just have the result be in table form (the above is very simplified, but it would solve my issue). The closest I think I've gotten is with the following statement (which just returned 1, 2, 3, null).
select t.*
from mytable, table(mytable.col)(+) t;
I've tried listagg
, but couldn't get it to work for my case. I'm currently trying to read more into nested tables, but it has been slow going, and I haven't been able to find anything for this specific issue (nested tables).