title: pl/sql function- pass multiple varchar2 values dynamically for SELECT ... NOT IN()
body: <p>I have a table <code>EMP</code> with following definition:</p>
  
  <pre><code>EMP_ID         NOT NULL   NUMBER(6)    
  EMP_NAME       NOT NULL   VARCHAR2(25) 
  EMAIL          NOT NULL   VARCHAR2(25) 
  PHONE_NUMBER              VARCHAR2(20) 
  HIRE_DATE      NOT NULL   DATE         
  JOB_ID         NOT NULL   VARCHAR2(10) 
  SALARY                    NUMBER(8,2)
  </code></pre>
  
  <p>If we want to count employees whose name not in 'King', 'Steve', 'John' we simply use this query :</p>
  
  <pre><code>SELECT count(*) FROM emp WHERE emp_name NOT IN('King','Steve','John');
  </code></pre>
  
  <p><hr>
  <strong>Now Here is what I want above this:</strong></p>
  
  <p>What I want to do is, Create a <code>PL/SQL Function</code> which returns number of count according to the dynamic input, Like if we pass:</p>
  
  <pre><code>SELECT count_emp('King,Steve,John') FROM dual;
  SELECT count_emp('William,Donald') FROM dual;
  SELECT count_emp('Daniel') FROM dual;
  </code></pre>
  
  <p>needs to return appropriate count, how can I achieve this using <code>PL/SQL FUNCTION</code></p>
  
  <hr>
  
  <p><strong>This is what I have tried and Needs guideline:</strong></p>
  
  <pre><code>CREATE OR REPLACE FUNCTION count_emp(emp_nm IN varchar) 
  RETURN number
  IS
    cnt      NUMBER;
  BEGIN
    SELECT count(*) INTO cnt FROM emp WHERE emp_name NOT IN(emp_nm);
    RETURN cnt;
  END;
  </code></pre>
  
  <p>it is giving result for single name, but how can I split/format multiple input(i.e. <code>emp_nm</code>) to pass in <code>NOT IN()</code>?</p>