title: PL SQL: how do I get more than one value in the same cell? listagg, ok. But
body: <p>I'm new to stackoverflow so please excuse me if I'm not asking properly.</p>
  
  <p>I just received a ticket asking to modify a report.</p>
  
  <p>The actual situation is that when an employee is enrolled into a training that has more than one instructor employees' records get duplicate as many times as the number of instructors.</p>
  
  <p>e.g. as follow</p>
  
  <hr>
  
  <p>Stud_id |    ins_fname   | ins_lname</p>
  
  <hr>
  
  <p>001    |        ugo       |    red</p>
  
  <hr>
  
  <p>001       |     marco       |   green</p>
  
  <p>instead it should be </p>
  
  <hr>
  
  <p>Stud_id   | ins_fname  | ins_lname</p>
  
  <hr>
  
  <p>001    |    ugo, marco | red, green</p>
  
  <p>I know that there is LISTAGG to solve this issue, however is not working as it should.</p>
  
  <p>I guess because the stud_id values has being pulled from a nested table, so the report I am working on looks something like this</p>
  
  <p>SELECT
  col_1,
  col_2,
  ins_fname,
  ins_lname,
  col_n+1...n,
  FROM
  (SELECT DISTINCT
    stud.stud_id,
    col_n+1...n,
    FROM table
  ) tableName,
  tableName2,
  tableName3,</p>
  
  <p>WHERE 1=1</p>
  
  <p>Is there any chance that this is impacting the LISTAGG functionalities?</p>
  
  <p>The error I'm getting is the following</p>
  
  <p>The column 'I.MI' (which follows the columns I'm trying to listagg out) is invalid in the select list because the GROUP BY clause or an aggregation function does not contain it: line 26 col 7 (at pos 1010)
      at de.simplicit.vjdbc.util.SQLExceptionHelper.wrapSQLException(SQLExceptionHelper.java:44)
      at de.simplicit.vjdbc.util.SQLExceptionHelper.wrap(SQLExceptionHelper.java:25)
      at de.simplicit.vjdbc.server.command.CommandProcessor.process(CommandProcessor.java:165)
      at de.simplicit.vjdbc.server.servlet.ServletCommandSink.handleRequest(ServletCommandSink.java:176)
      at de.simplicit.vjdbc.server.servlet.ServletCommandSink.doPost(ServletCommandSink.java:150)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.</p>
  
  <p>I know that is not the clearest question but still I'd strongly appreciate any support.</p>
  
  <p>The compiler I'm using is Plateau Report Designer which is something built on top of BIRT linked to ORACLE db</p>
  
  <p>Thank you all and happy new year</p>