title: While INSERT got error PLS-00904: stud.col3 is invalid identifier
body: <p>In my stored procedure I want if the value of <strong>col1</strong> &amp; <strong>col2</strong> match with employee then insert the unique record of the employee. If not found then match the value of <strong>col1</strong>, <strong>col2</strong> &amp; <strong>col3</strong> with <strong><em>employee</em></strong> match then insert the value. If also not found while match all these column then insert the record by using another column.</p>
  
  <p>Also one more thing that I want find list of values like <strong>emp_id</strong> by passing the another column value and if a single record can not <strong>match</strong> then make <strong>emp_id</strong> as <strong>NULL</strong>.</p>
  
  <p>Also I want to insert one record at a time after match with <strong>txt</strong> along with others table having data like <strong>emp</strong>.</p>
  
  <pre><code>create or replace procedure sp_ex
  as
      cursor c1 is select * from txt%rowtype;
      v_col1 tbl1.col1%type;
      type record is table of txt%rowtype;  --Staging table
      v_rc record := record();
  begin
      open c1;
      loop 
          fetch c1 bulk collect into v_rc limit 1000;
  
          loop
              for i in 1..v_rc.count loop
                  select col1 into v_col1 from tbl1
                  where  exists (select col1 from tbl1 where tbl1.col1 = emp.col1);
  
                  insert 
                      when txt.col1 = emp.col1 and txt.col2 = stud.col2 then
                           into main_table(columns) values(v_rc(i).col1, ...)
  
                      when txt.col1 = emp.col1 and txt.col2 = stud.col2 and txt.col3 = stud.col3 then 
                           into main_table(columns) values(v_rc(i).col1, ...)
  
                      else 
                           insert into main_table(columns) values(v_rc(i).col1, ...)
                           select * from txt;
                  end loop;
                  exit when v_rc.count &lt; limit;
  
          end loop;
          close c1;
  end sp_ex;
  </code></pre>
  
  <p>While <strong>emp</strong>, <strong>stud</strong> are the different tables where i have to match with <strong>txt</strong>.
  In that Stored Proc I want to load data from <strong>txt</strong> into <strong>main_table</strong> in batch processing mode. The data would be match one by one record then after if matching condition match then load into the main table. How can i create the stored proc so that the Data will load by above logic one by one in batch processing. Could you please help me to share your idea. Thanks</p>