My customer is using db2 database without listagg function, but I need to somehow aggregate the primary key information within one field.
Right now (for Oracle) I am
If your version of DB2 supports pureXML (that would be at least DB2 for LUW 9.1 and I believe DB2 9 for z/OS), in addition to what @PM77-1 suggested above, you could use the XMLAGG function:
select xmlserialize(
xmlagg(
xmlconcat(
xmltext(column_name),
xmltext(':'),
xmltext(content),
xmltext(',')
)
) as varchar(10000)
)
from
yourtable
...