title: Bulk inserting in Oracle PL/SQL
body: <p>I have around 5 million of records which needs to be copied from table of one schema to table of another schema(in the same database). I have prepared a script but it gives me the below error.</p>
  
  <blockquote>
    <p>ORA-06502: PL/SQL: numeric or value error: Bulk bind: Error in define</p>
  </blockquote>
  
  <p>Following is my script</p>
  
  <pre><code>DECLARE    
      TYPE tA IS TABLE OF varchar2(10) INDEX BY PLS_INTEGER;
      TYPE tB IS TABLE OF SchemaA.TableA.band%TYPE INDEX BY PLS_INTEGER;
      TYPE tD IS TABLE OF SchemaA.TableA.start_date%TYPE INDEX BY PLS_INTEGER;
      TYPE tE IS TABLE OF SchemaA.TableA.end_date%TYPE INDEX BY PLS_INTEGER;        
      rA tA;
      rB tB;
      rD tD;
      rE tE;
      f number :=0;    
  BEGIN
  
      SELECT col1||col2||col3 as main_col, band, effective_start_date as start_date, effective_end_date as end_date 
      BULK COLLECT INTO rA, rB, rD, rE 
      FROM schemab.tableb;
  
      FORALL i IN rA.FIRST..rE.LAST
          insert into SchemaA.TableA(main_col, BAND, user_type, START_DATE, END_DATE, roll_no) 
          values(rA(i), rB(i), 'C', rD(i), rE(i), 71);
  
      f:=f+1;
  
      if (f=10000) then
          commit;
      end if;
  
  end;
  </code></pre>
  
  <p>Could you please help me in finding where the error lies?</p>