
/**


 **/
prompt
prompt 'create table eoda.t  '
declare row_count number;
begin
	select 1 into row_count from dual where exists (select 1 from user_tables where table_name = upper('t') );
	if row_count = 1 then
		execute immediate 'drop table eoda.t';
	end if;
	execute immediate '
		create table eoda.t
		(
			id   number primary key,
			x    char(2000),
			y    char(2000),
			z    char(2000)
		)
	';
end;
/

prompt
prompt ' insert data into eoda.t'
begin
	dbms_stats.set_table_stats( user,'T',numrows=>10000,numblks=>10000 );
	insert into eoda.t select rownum,'x','y','z' from all_objects where rownum <= 10000;
end;
/

variable redo number;
prompt
prompt 'select data 10000 times'
declare l_rec t%rowtype;
begin
	:redo := get_stat_val('redo size');
	for i in 1 .. 10000
	loop
		select * into l_rec from eoda.t where id=i;
	end loop;
	dbms_output.put_line ( (get_stat_val('redo size')-:redo) || ' byties of redo generated...' );
end;
/

variable redo number;
prompt
prompt 'select data 10000 times, second'
declare l_rec t%rowtype;
begin
	:redo := get_stat_val('redo size');
	for i in 1 .. 10000
	loop
		select * into l_rec from eoda.t where id=i;
	end loop;
	dbms_output.put_line ( (get_stat_val('redo size')-:redo) || ' byties of redo generated...' );
end;
/
