-------------------------------------------------------------------------------------------------
--  Script : compression_effect_02.sql
-------------------------------------------------------------------------------------------------
-- THIS SCRIPT DEMONSTRATES THE EFFECT OF COMPRESSION, FOR BULK INSERTS
--
--  Author : Riyaj Shamsudeen
--  No implied or explicit warranty !
-------------------------------------------------------------------------------------------------
set serveroutput on size 1000000
prompt Test case : IOTs to reduce redo : Bulk inserts 
set timing off
set feedback off
drop table ilp_activity_heap;
create table ilp_activity_heap
(
item  number not null, 
period  number not null, 
location number not null, 
item_type number not null,
sales_units number(*,8), 
sales_price number(*,8), 
ap_units number (*,8), 
ap_price number(*,8),
fc_units number (*,8), 
fc_price number(*,8)
) 
nologging
storage (initial 10M next 10M pctincrease 0)
;
create unique index ilp_act_heap_i1 on  ilp_activity_heap ( item,location,period,item_type) nologging;
alter table  ilp_activity_heap add  (constraint ilp_activity_heap_pk  primary key ( item,location,period,item_type) );
drop type ilp_activity_table
/
create or replace type ilp_activity_type   as object
(
	item  number ,
	period  number ,
	location number ,
	item_type number,
	sales_units number,
	sales_price number,
	ap_units number, 
	ap_price number,
	fc_units number ,
	fc_price number
  )
/
create or replace type ilp_activity_table is table of ilp_activity_type 
/
set feedback on
declare
  i number;
  l_begin_redo_size number;
  l_end_redo_size number;
  l_generated_redo number;

  l_begin_com_clnout number;
  l_end_com_clnout number;

  l_begin_time number;
  l_end_time number;
  l_elapsed_time number;

  type item_tab is table of  ilp_activity_heap.item%TYPE;
  type period_tab is table of  ilp_activity_heap.period%TYPE;
  type location_tab is table of  ilp_activity_heap.location%TYPE;
  type item_type_tab is table of  ilp_activity_heap.item_type%TYPE;
  type sales_units_tab is table of  ilp_activity_heap.sales_units%TYPE;
  type sales_price_tab is table of  ilp_activity_heap.sales_price%TYPE;
  type ap_units_tab is table of  ilp_activity_heap.ap_units%TYPE;
  type ap_price_tab is table of  ilp_activity_heap.ap_price%TYPE;
  type fc_units_tab is table of  ilp_activity_heap.fc_units%TYPE;
  type fc_price_tab is table of  ilp_activity_heap.fc_price%TYPE;


  l_item_tab  item_tab := item_tab ();
  l_period_tab  period_tab:= period_tab();
  l_location_tab  location_tab:=location_tab();
  l_item_type_tab  item_type_tab:=item_type_tab();
  l_sales_units_tab  sales_units_tab:=sales_units_tab();
  l_sales_price_tab  sales_price_tab:=sales_price_tab();
  l_ap_units_tab  ap_units_tab:=ap_units_tab();
  l_ap_price_tab  ap_price_tab:=ap_price_tab();
  l_fc_units_tab  fc_units_tab:=fc_units_tab();
  l_fc_price_tab  fc_price_tab:=fc_price_tab();

  l_index number := 1;

begin

l_item_tab.extend (25000);
l_period_tab.extend (25000);
l_location_tab.extend (25000);
l_item_type_tab.extend (25000);
l_sales_units_tab.extend (25000);
l_sales_price_tab.extend (25000);
l_ap_units_tab.extend (25000);
l_ap_price_tab.extend (25000);
l_fc_units_tab.extend (25000);
l_fc_price_tab.extend (25000);

for i in 1 .. 2 loop
  for j  in  1 .. 5 loop
    for k in 1  .. 500 loop
        for l in 1 .. 5 loop
		l_item_tab (l_index) := i;
		l_period_tab (l_index) := j;
		l_location_tab (l_index) := k;
		l_item_type_tab (l_index) := l;
		l_sales_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_sales_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);

		l_index := l_index +1;
        end loop;
    end loop;
  end loop;
end loop;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_begin_redo_size , l_begin_com_clnout from dual;
l_begin_time := dbms_utility.get_time;
  
  FORALL j in l_item_tab.first .. l_item_tab.last
          insert into ilp_activity_heap
          values
                (
		l_item_tab (j),
		l_period_tab (j),
		l_location_tab (j) ,
		l_item_type_tab (j),
		l_sales_units_tab (j),
		l_sales_price_tab (j),
		l_ap_units_tab (j),
		l_ap_price_tab (j) ,
		l_fc_units_tab (j) ,
		l_fc_price_tab (j)
                );
commit;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_end_redo_size , l_end_com_clnout from dual;
l_end_time := dbms_utility.get_time;

dbms_output.put_line ('Total redo generated for heap with primary key, using bulk insert ==>'||to_char( l_end_redo_size - l_begin_redo_size));
dbms_output.put_line ('Total redo entries generated ==>'||to_char( l_end_com_clnout - l_begin_com_clnout));
dbms_output.put_line ('Elapsed time in seconds ==>'||to_char(trunc(( l_end_time-l_begin_time)/100, 2 )));
end;
/
set feedback off
drop table ilp_activity_iot;
create table ilp_activity_iot
(
item  number not null, 
period  number not null, 
location number not null, 
item_type number not null,
sales_units number(*,8), 
sales_price number(*,8), 
ap_units number (*,8), 
ap_price number(*,8),
fc_units number (*,8), 
fc_price number(*,8), 
constraint ilp_activity_iot_pk primary key ( item, location, period, item_type )
)
organization index
;
drop type ilp_activity_table
/
create or replace type ilp_activity_type   as object
(
	item  number ,
	period  number ,
	location number ,
	item_type number,
	sales_units number,
	sales_price number,
	ap_units number, 
	ap_price number,
	fc_units number ,
	fc_price number
  )
/
create or replace type ilp_activity_table is table of ilp_activity_type 
/
set feedback on
declare
  i number;
  l_begin_redo_size number;
  l_end_redo_size number;
  l_generated_redo number;

  l_begin_com_clnout number;
  l_end_com_clnout number;

  l_begin_time number;
  l_end_time number;
  l_elapsed_time number;

  type item_tab is table of  ilp_activity_heap.item%TYPE;
  type period_tab is table of  ilp_activity_heap.period%TYPE;
  type location_tab is table of  ilp_activity_heap.location%TYPE;
  type item_type_tab is table of  ilp_activity_heap.item_type%TYPE;
  type sales_units_tab is table of  ilp_activity_heap.sales_units%TYPE;
  type sales_price_tab is table of  ilp_activity_heap.sales_price%TYPE;
  type ap_units_tab is table of  ilp_activity_heap.ap_units%TYPE;
  type ap_price_tab is table of  ilp_activity_heap.ap_price%TYPE;
  type fc_units_tab is table of  ilp_activity_heap.fc_units%TYPE;
  type fc_price_tab is table of  ilp_activity_heap.fc_price%TYPE;


  l_item_tab  item_tab := item_tab ();
  l_period_tab  period_tab:= period_tab();
  l_location_tab  location_tab:=location_tab();
  l_item_type_tab  item_type_tab:=item_type_tab();
  l_sales_units_tab  sales_units_tab:=sales_units_tab();
  l_sales_price_tab  sales_price_tab:=sales_price_tab();
  l_ap_units_tab  ap_units_tab:=ap_units_tab();
  l_ap_price_tab  ap_price_tab:=ap_price_tab();
  l_fc_units_tab  fc_units_tab:=fc_units_tab();
  l_fc_price_tab  fc_price_tab:=fc_price_tab();

  l_index number := 1;

begin

l_item_tab.extend (25000);
l_period_tab.extend (25000);
l_location_tab.extend (25000);
l_item_type_tab.extend (25000);
l_sales_units_tab.extend (25000);
l_sales_price_tab.extend (25000);
l_ap_units_tab.extend (25000);
l_ap_price_tab.extend (25000);
l_fc_units_tab.extend (25000);
l_fc_price_tab.extend (25000);

for i in 1 .. 2 loop
  for j  in  1 .. 5 loop
    for k in 1  .. 500 loop
        for l in 1 .. 5 loop
		l_item_tab (l_index) := i;
		l_period_tab (l_index) := j;
		l_location_tab (l_index) := k;
		l_item_type_tab (l_index) := l;
		l_sales_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_sales_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);

		l_index := l_index +1;
        end loop;
    end loop;
  end loop;
end loop;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_begin_redo_size , l_begin_com_clnout from dual;

l_begin_time := dbms_utility.get_time;
  
  FORALL j in l_item_tab.first .. l_item_tab.last
          insert into ilp_activity_iot
          values
                (
		l_item_tab (j),
		l_period_tab (j),
		l_location_tab (j) ,
		l_item_type_tab (j),
		l_sales_units_tab (j),
		l_sales_price_tab (j),
		l_ap_units_tab (j),
		l_ap_price_tab (j) ,
		l_fc_units_tab (j) ,
		l_fc_price_tab (j)
                );
commit;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_end_redo_size , l_end_com_clnout from dual;

l_end_time := dbms_utility.get_time;

dbms_output.put_line ('Total redo generated for iot with zero compression, using bulk insert ==>'||to_char( l_end_redo_size - l_begin_redo_size));
dbms_output.put_line ('Total redo entries generated ==>'||to_char( l_end_com_clnout - l_begin_com_clnout));
dbms_output.put_line ('Elapsed time in seconds ==>'||to_char(trunc(( l_end_time-l_begin_time)/100, 2 )));
end;
/
set feedback off
drop table ilp_activity_iot;
create table ilp_activity_iot
(
item  number not null, 
period  number not null, 
location number not null, 
item_type number not null,
sales_units number(*,8), 
sales_price number(*,8), 
ap_units number (*,8), 
ap_price number(*,8),
fc_units number (*,8), 
fc_price number(*,8), 
constraint ilp_activity_iot_pk primary key ( item, location, period, item_type )
)
organization index
compress 1
;
drop type ilp_activity_table
/
create or replace type ilp_activity_type   as object
(
	item  number ,
	period  number ,
	location number ,
	item_type number,
	sales_units number,
	sales_price number,
	ap_units number, 
	ap_price number,
	fc_units number ,
	fc_price number
  )
/
create or replace type ilp_activity_table is table of ilp_activity_type 
/
set feedback on
declare
  i number;
  l_begin_redo_size number;
  l_end_redo_size number;
  l_generated_redo number;

  l_begin_com_clnout number;
  l_end_com_clnout number;

  l_begin_time number;
  l_end_time number;
  l_elapsed_time number;

  type item_tab is table of  ilp_activity_heap.item%TYPE;
  type period_tab is table of  ilp_activity_heap.period%TYPE;
  type location_tab is table of  ilp_activity_heap.location%TYPE;
  type item_type_tab is table of  ilp_activity_heap.item_type%TYPE;
  type sales_units_tab is table of  ilp_activity_heap.sales_units%TYPE;
  type sales_price_tab is table of  ilp_activity_heap.sales_price%TYPE;
  type ap_units_tab is table of  ilp_activity_heap.ap_units%TYPE;
  type ap_price_tab is table of  ilp_activity_heap.ap_price%TYPE;
  type fc_units_tab is table of  ilp_activity_heap.fc_units%TYPE;
  type fc_price_tab is table of  ilp_activity_heap.fc_price%TYPE;


  l_item_tab  item_tab := item_tab ();
  l_period_tab  period_tab:= period_tab();
  l_location_tab  location_tab:=location_tab();
  l_item_type_tab  item_type_tab:=item_type_tab();
  l_sales_units_tab  sales_units_tab:=sales_units_tab();
  l_sales_price_tab  sales_price_tab:=sales_price_tab();
  l_ap_units_tab  ap_units_tab:=ap_units_tab();
  l_ap_price_tab  ap_price_tab:=ap_price_tab();
  l_fc_units_tab  fc_units_tab:=fc_units_tab();
  l_fc_price_tab  fc_price_tab:=fc_price_tab();

  l_index number := 1;

begin

l_item_tab.extend (25000);
l_period_tab.extend (25000);
l_location_tab.extend (25000);
l_item_type_tab.extend (25000);
l_sales_units_tab.extend (25000);
l_sales_price_tab.extend (25000);
l_ap_units_tab.extend (25000);
l_ap_price_tab.extend (25000);
l_fc_units_tab.extend (25000);
l_fc_price_tab.extend (25000);

for i in 1 .. 2 loop
  for j  in  1 .. 5 loop
    for k in 1  .. 500 loop
        for l in 1 .. 5 loop
		l_item_tab (l_index) := i;
		l_period_tab (l_index) := j;
		l_location_tab (l_index) := k;
		l_item_type_tab (l_index) := l;
		l_sales_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_sales_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);

		l_index := l_index +1;
        end loop;
    end loop;
  end loop;
end loop;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_begin_redo_size , l_begin_com_clnout from dual;

l_begin_time := dbms_utility.get_time;
  
  FORALL j in l_item_tab.first .. l_item_tab.last
          insert into ilp_activity_iot
          values
                (
		l_item_tab (j),
		l_period_tab (j),
		l_location_tab (j) ,
		l_item_type_tab (j),
		l_sales_units_tab (j),
		l_sales_price_tab (j),
		l_ap_units_tab (j),
		l_ap_price_tab (j) ,
		l_fc_units_tab (j) ,
		l_fc_price_tab (j)
                );
commit;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_end_redo_size , l_end_com_clnout from dual;

l_end_time := dbms_utility.get_time;

dbms_output.put_line ('Total redo generated for iot with compression 1, using bulk insert ==>'||to_char( l_end_redo_size - l_begin_redo_size));
dbms_output.put_line ('Total redo entries generated ==>'||to_char( l_end_com_clnout - l_begin_com_clnout));
dbms_output.put_line ('Elapsed time in seconds ==>'||to_char(trunc(( l_end_time-l_begin_time)/100, 2 )));
end;
/
set feedback off
drop table ilp_activity_iot;
create table ilp_activity_iot
(
item  number not null, 
period  number not null, 
location number not null, 
item_type number not null,
sales_units number(*,8), 
sales_price number(*,8), 
ap_units number (*,8), 
ap_price number(*,8),
fc_units number (*,8), 
fc_price number(*,8), 
constraint ilp_activity_iot_pk primary key ( item, location, period, item_type )
)
organization index
compress 2
;
drop type ilp_activity_table
/
create or replace type ilp_activity_type   as object
(
	item  number ,
	period  number ,
	location number ,
	item_type number,
	sales_units number,
	sales_price number,
	ap_units number, 
	ap_price number,
	fc_units number ,
	fc_price number
  )
/
create or replace type ilp_activity_table is table of ilp_activity_type 
/
set feedback on
declare
  i number;
  l_begin_redo_size number;
  l_end_redo_size number;
  l_generated_redo number;

  l_begin_com_clnout number;
  l_end_com_clnout number;

  l_begin_time number;
  l_end_time number;
  l_elapsed_time number;

  type item_tab is table of  ilp_activity_heap.item%TYPE;
  type period_tab is table of  ilp_activity_heap.period%TYPE;
  type location_tab is table of  ilp_activity_heap.location%TYPE;
  type item_type_tab is table of  ilp_activity_heap.item_type%TYPE;
  type sales_units_tab is table of  ilp_activity_heap.sales_units%TYPE;
  type sales_price_tab is table of  ilp_activity_heap.sales_price%TYPE;
  type ap_units_tab is table of  ilp_activity_heap.ap_units%TYPE;
  type ap_price_tab is table of  ilp_activity_heap.ap_price%TYPE;
  type fc_units_tab is table of  ilp_activity_heap.fc_units%TYPE;
  type fc_price_tab is table of  ilp_activity_heap.fc_price%TYPE;


  l_item_tab  item_tab := item_tab ();
  l_period_tab  period_tab:= period_tab();
  l_location_tab  location_tab:=location_tab();
  l_item_type_tab  item_type_tab:=item_type_tab();
  l_sales_units_tab  sales_units_tab:=sales_units_tab();
  l_sales_price_tab  sales_price_tab:=sales_price_tab();
  l_ap_units_tab  ap_units_tab:=ap_units_tab();
  l_ap_price_tab  ap_price_tab:=ap_price_tab();
  l_fc_units_tab  fc_units_tab:=fc_units_tab();
  l_fc_price_tab  fc_price_tab:=fc_price_tab();

  l_index number := 1;

begin

l_item_tab.extend (25000);
l_period_tab.extend (25000);
l_location_tab.extend (25000);
l_item_type_tab.extend (25000);
l_sales_units_tab.extend (25000);
l_sales_price_tab.extend (25000);
l_ap_units_tab.extend (25000);
l_ap_price_tab.extend (25000);
l_fc_units_tab.extend (25000);
l_fc_price_tab.extend (25000);

for i in 1 .. 2 loop
  for j  in  1 .. 5 loop
    for k in 1  .. 500 loop
        for l in 1 .. 5 loop
		l_item_tab (l_index) := i;
		l_period_tab (l_index) := j;
		l_location_tab (l_index) := k;
		l_item_type_tab (l_index) := l;
		l_sales_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_sales_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);

		l_index := l_index +1;
        end loop;
    end loop;
  end loop;
end loop;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_begin_redo_size , l_begin_com_clnout from dual;

l_begin_time := dbms_utility.get_time;
  
  FORALL j in l_item_tab.first .. l_item_tab.last
          insert into ilp_activity_iot
          values
                (
		l_item_tab (j),
		l_period_tab (j),
		l_location_tab (j) ,
		l_item_type_tab (j),
		l_sales_units_tab (j),
		l_sales_price_tab (j),
		l_ap_units_tab (j),
		l_ap_price_tab (j) ,
		l_fc_units_tab (j) ,
		l_fc_price_tab (j)
                );
commit;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_end_redo_size , l_end_com_clnout from dual;

l_end_time := dbms_utility.get_time;

dbms_output.put_line ('Total redo generated for iot with compression 2, using bulk insert ==>'||to_char( l_end_redo_size - l_begin_redo_size));
dbms_output.put_line ('Total redo entries generated ==>'||to_char( l_end_com_clnout - l_begin_com_clnout));
dbms_output.put_line ('Elapsed time in seconds ==>'||to_char(trunc(( l_end_time-l_begin_time)/100, 2 )));
end;
/
set feedback off
drop table ilp_activity_iot;
create table ilp_activity_iot
(
item  number not null, 
period  number not null, 
location number not null, 
item_type number not null,
sales_units number(*,8), 
sales_price number(*,8), 
ap_units number (*,8), 
ap_price number(*,8),
fc_units number (*,8), 
fc_price number(*,8), 
constraint ilp_activity_iot_pk primary key ( item, location, period, item_type )
)
organization index
compress 3
;
drop type ilp_activity_table
/
create or replace type ilp_activity_type   as object
(
	item  number ,
	period  number ,
	location number ,
	item_type number,
	sales_units number,
	sales_price number,
	ap_units number, 
	ap_price number,
	fc_units number ,
	fc_price number
  )
/
create or replace type ilp_activity_table is table of ilp_activity_type 
/
set feedback on
declare
  i number;
  l_begin_redo_size number;
  l_end_redo_size number;
  l_generated_redo number;

  l_begin_com_clnout number;
  l_end_com_clnout number;

  l_begin_time number;
  l_end_time number;
  l_elapsed_time number;

  type item_tab is table of  ilp_activity_heap.item%TYPE;
  type period_tab is table of  ilp_activity_heap.period%TYPE;
  type location_tab is table of  ilp_activity_heap.location%TYPE;
  type item_type_tab is table of  ilp_activity_heap.item_type%TYPE;
  type sales_units_tab is table of  ilp_activity_heap.sales_units%TYPE;
  type sales_price_tab is table of  ilp_activity_heap.sales_price%TYPE;
  type ap_units_tab is table of  ilp_activity_heap.ap_units%TYPE;
  type ap_price_tab is table of  ilp_activity_heap.ap_price%TYPE;
  type fc_units_tab is table of  ilp_activity_heap.fc_units%TYPE;
  type fc_price_tab is table of  ilp_activity_heap.fc_price%TYPE;


  l_item_tab  item_tab := item_tab ();
  l_period_tab  period_tab:= period_tab();
  l_location_tab  location_tab:=location_tab();
  l_item_type_tab  item_type_tab:=item_type_tab();
  l_sales_units_tab  sales_units_tab:=sales_units_tab();
  l_sales_price_tab  sales_price_tab:=sales_price_tab();
  l_ap_units_tab  ap_units_tab:=ap_units_tab();
  l_ap_price_tab  ap_price_tab:=ap_price_tab();
  l_fc_units_tab  fc_units_tab:=fc_units_tab();
  l_fc_price_tab  fc_price_tab:=fc_price_tab();

  l_index number := 1;

begin

l_item_tab.extend (25000);
l_period_tab.extend (25000);
l_location_tab.extend (25000);
l_item_type_tab.extend (25000);
l_sales_units_tab.extend (25000);
l_sales_price_tab.extend (25000);
l_ap_units_tab.extend (25000);
l_ap_price_tab.extend (25000);
l_fc_units_tab.extend (25000);
l_fc_price_tab.extend (25000);

for i in 1 .. 2 loop
  for j  in  1 .. 5 loop
    for k in 1  .. 500 loop
        for l in 1 .. 5 loop
		l_item_tab (l_index) := i;
		l_period_tab (l_index) := j;
		l_location_tab (l_index) := k;
		l_item_type_tab (l_index) := l;
		l_sales_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_sales_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_ap_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_units_tab (l_index) := trunc(dbms_random.value(1, 100),8);
		l_fc_price_tab (l_index) := trunc(dbms_random.value(1, 100),8);

		l_index := l_index +1;
        end loop;
    end loop;
  end loop;
end loop;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_begin_redo_size , l_begin_com_clnout from dual;

l_begin_time := dbms_utility.get_time;
  
  FORALL j in l_item_tab.first .. l_item_tab.last
          insert into ilp_activity_iot
          values
                (
		l_item_tab (j),
		l_period_tab (j),
		l_location_tab (j) ,
		l_item_type_tab (j),
		l_sales_units_tab (j),
		l_sales_price_tab (j),
		l_ap_units_tab (j),
		l_ap_price_tab (j) ,
		l_fc_units_tab (j) ,
		l_fc_price_tab (j)
                );
commit;

select  get_my_statistics('redo size'), get_my_statistics('redo entries')
        into  l_end_redo_size , l_end_com_clnout from dual;

l_end_time := dbms_utility.get_time;

dbms_output.put_line ('Total redo generated for iot with compression 3, using bulk insert ==>'||to_char( l_end_redo_size - l_begin_redo_size));
dbms_output.put_line ('Total redo entries generated ==>'||to_char( l_end_com_clnout - l_begin_com_clnout));
dbms_output.put_line ('Elapsed time in seconds ==>'||to_char(trunc(( l_end_time-l_begin_time)/100, 2 )));
end;
/

hostgator