title: Multiple inputs into oracle SQL function parameters
body: <p>Okay, I have written a basic function in oracle to return the current worker based on the client id and the date specified.  </p>
  
  <p>It works as intended.</p>
  
  <pre><code>FUNCTION get_worker_new_test  (p_id IN VARCHAR2, p_date IN DATE, w_type IN
  VARCHAR2)     RETURN VARCHAR2 IS
  
  CURSOR c1 IS
  
   SELECT 
   O_RELATIONSHIPS.ID
  
   FROM o_relationships
   WHERE rel_source_per_gro_id = p_id
   AND rel_rty_code in (w_type)
   AND p_date BETWEEN rel_start_date AND NVL(rel_end_date, SYSDATE)
   ORDER BY rel_start_date DESC;
  
  
   l_name VARCHAR2(70) ;
  
  BEGIN
  OPEN c1;
  FETCH c1 INTO l_name;
  CLOSE c1;
  
  RETURN l_name;
  
  END;
  </code></pre>
  
  <p>So for example, a query like this:</p>
  
  <pre><code>SELECT
  CLIENT,
  get_worker_new_test(CLIENT,sysdate,'WORKER')
  FROM TABLE
  </code></pre>
  
  <p>Would return something like:</p>
  
  <p>Client1 | A WORKER</p>
  
  <p>However, I was wondering if it was possible to ask the function to return the latest worker from a number of different worker types.  </p>
  
  <p>So for example, I'd write the query like this:</p>
  
  <pre><code>SELECT
  CLIENT,
  get_worker_new_test(CLIENT,sysdate,'WORKER,CLERK,MANAGER')
  FROM TABLE
  </code></pre>
  
  <p>And it would return:</p>
  
  <p>Client1 | A MANAGER</p>
  
  <p>if the latest worker type assigned was a manager.  I think I need a function that will split the string into seperate entries, but even then I'm not sure if there's a better way of going about it.  Any advice or guidance would be appreciated. </p>
  
  <p>Thanks.</p>