title: does LISTAGG in oracle handle number datatype
body: <p>I have a result as shown below </p>
  
  <pre><code>I_KEY 
  10001
  10002
  10003
  10004
  10005
  </code></pre>
  
  <p>I need to modify the result to show output as </p>
  
  <pre><code>I_KEY
  10001,10002,10003,10004,10005
  </code></pre>
  
  <p>I have written oracle function to return the aggregate result as shown below, My doubt is, will the LISTAGG handle value with <strong>NUMBER</strong> type?</p>
  
  <pre><code>create or replace 
  FUNCTION GET_I_KEY(
   RETURN NUMBER
    IS
      TEST I_DETAILS.I_KEY%TYPE;
    BEGIN
      SELECT LISTAGG(I_KEY, ',') WITHIN GROUP (ORDER BY I_KEY)
      INTO TEST
      FROM I_DETAILS 
  RETURN TEST;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
      TEST := NULL;
      RETURN TEST;
    END;
  </code></pre>
  
  <p>UPDATED FUNCTION </p>
  
  <pre><code>create or replace 
  FUNCTION GET_I_KEY(
  IN I_DETAILS.I_NAME%TYPE)
  RETURN VARCHAR2
  IS
    TEST VARCHAR2(4000);
  BEGIN
    SELECT LISTAGG(I_KEY, ',') WITHIN GROUP (ORDER BY I_KEY)
    INTO TEST
    FROM I_DETAILS ID ,I_TYPE IT
    WHERE ID.I_KEY = IT.I_KEY
    AND ID.I_NAME = IN;
  RETURN TEST;
  END;
  </code></pre>