title: How to return multiple values through function
body: <p>I have created the below function that will return workspace details which the loggedin user has access to.</p>
  
  <p>But this function is returning only the first record from the select list.</p>
  
  <p>I need all the records to be displayed as output.</p>
  
  <p>Please modify it and let me know.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION "F_WORKSPACE_LOGIN_USERS" (
    p_email VARCHAR2
  ) RETURN VARCHAR2 IS
  
    l_error       VARCHAR2(1000);
    l_workspace   VARCHAR2(1000);
    l_teams       VARCHAR2(1000);
    l_team        VARCHAR2(1000);
  BEGIN
    FOR i IN ( SELECT a.name workspace,
                      a.team_id id
               FROM slackdatawarehouse.teams a,
                    ( SELECT TRIM(workspaces) workspaces
                      FROM alluser_workspaces_fact
                      WHERE lower(email) = lower(p_email)
    ) b
               WHERE a.team_id IN ( SELECT c.team_id
                                    FROM slackdatawarehouse.team_tokens c
    )
                     OR   instr(', '
    || lower(b.workspaces),', '
    || lower(a.name) ) &gt; 0
    ORDER BY 1 ) LOOP
      l_teams := l_team
      || ','
      || i.id;
      l_teams := ltrim(rtrim(l_teams,','),',');
      RETURN l_teams;
    END LOOP;
  END;
  </code></pre>
  
  <p>Current output is : </p>
  
  <p>T6HPQ5LF7,T6XBXVAA1,T905JLZ62,T7CN08JPQ,T9MV4732M,T5PGS72NA,T5A4YHMUH,TAAFTFS0P,T69BE9T2A,T85D2D8MT,T858U7SF4,T9D16DF5X,T9DHDV61G,T9D17RDT3,T5Y03HDQ8,T5F5QPRK7</p>
  
  <p>Required output is : </p>
  
  <pre><code>T6HPQ5LF7
  T6XBXVAA1
  T905JLZ62
  </code></pre>
  
  <p>i need output like above as one by one</p>