
prompt 
prompt 创建 state_pkg 
create or replace package state_pkg
as 
    type array is table of t_hashed.object_id%type;
    g_data array;
end;
/

prompt 
prompt 将查询得到的数据填入到state_pkg.g_data
begin 
    select object_id bulk collect into state_pkg.g_data 
    from t_hashed 
    order by dbms_random.random;
end;
/

prompt 
prompt heap代替hashed
declare 
    l_rec t_heap%rowtype;
begin 
    for i in 1 .. state_pkg.g_data.count
    loop
        select * into l_rec from t_heap
        where object_id = state_pkg.g_data(i);
    end loop;
end;
/

prompt 
prompt 执行报告
exec runstats_pkg.rs_stop (10000);
/
