Difference between revisions of "Forall insert"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
			
		
		
	
 (Created page with "Create table containing 100M records: <source lang="plsql"> create table testtable(id number);  declare   type t_table is table of testtable%rowtype index by binary_integer;...")  | 
			
(No difference) 
 | 
Latest revision as of 11:10, 4 April 2016
Create table containing 100M records:
create table testtable(id number);
declare
  type t_table is table of testtable%rowtype index by binary_integer;
  t_arr t_table;
  
  million number;
begin
  for m in 0 .. 99 loop
    million := m * 1000000;
    for i in 0 .. 999999 loop
      t_arr(i).id := million + i;
    end loop;
    
    forall i in t_arr.first .. t_arr.last
      insert into testtable values t_arr(i);
    commit;
  end loop;
end;
/