Oracle - Concatenate several columns in one cell separeted by newline

In order to concatenate the values of the same column across several records do:

   select replace( wm_concat(<FIELD_NAME>), ',', chr(13))
   from <TABLE_NAME>;

  • Add all distinct values in the same cell separated by ":"
         select distict(wm_concat(<FIELD_NAME>), ',', ':')
         from <TABLE_NAME>;
  • Add all values in the same cell separated by a new line "chr(13)"
         replace(wm_concat(<FIELD_NAME>), ',', chr(13))


Popular posts from this blog

Oracle - duplicate fields in RECORD,TABLE or argument list are not permitted

spring @async causing BeanCurrentlyInCreationException