title: insert into bulk data into the oracle tables with self join
body: <p>i have a table called <code>p_relations</code> which has 4 columns <code>employeename</code>, <code>access</code>, <code>manager_name</code>, <code>comments</code> and i can get these details from the table <code>p_employees</code> which has <code>emp_id</code>, <code>name</code>, <code>manager_id</code> .</p>
  
  <p>For example in <code>p_employees</code> table i have this data:</p>
  
  <pre><code>1001  kiran  2001
  2001  rahul  3001
  </code></pre>
  
  <p>now in <code>p_relations</code> table i have to insert the data like this</p>
  
  <pre><code>kiran  1   rahul
  </code></pre>
  
  <p>actually we have to insert bulk data . could you please sugget me the procedure or query for this.</p>
  
  <p>i developed simple procedure but it doesnt work:</p>
  
  <pre><code>    DECLARE
      e_name VARCHAR2(20);
      m_name VARCHAR2(20);
      manager_id VARCHAR2(20);
       CURSOR c_lecturer IS
         SELECT name,manager_id FROM p_employees;
     BEGIN
        OPEN c_lecturer;
       LOOP
       FETCH c_lecturer INTO e_name, manager_id;
           SELECT name INTO manager_name FROM WKS_CONT.SIBER_EMPLOYEES WHERE emp_id=manager_id;
  
            INSERT INTO p_relations  VALUES(e_name, ,1,manager_name);
  
      EXIT WHEN c_lecturer%NOTFOUND;
       END LOOP;
      CLOSE c_lecturer;
   END;
  </code></pre>
  
  <p>Please help me on this</p>