How to concat rows separated by a space in oracle?
问题 I am trying to concat/merge rows in a table to one single row. I tried using listagg but due to varchar limitation this doesn't work. create table tmp(word VARCHAR2(4000), lvl NUMBER); insert into tmp2 values('python',1); insert into tmp2 values('java',2); select listagg(word,' ') within group(order by lvl) as listagg_output from tmp; The output should look like python java. 回答1: What will you do with such a long string? Anyway, have a look at this example; if listagg won't work, xmlagg will.