
prompt
prompt 创建表eoda.t
declare 
    num number;
begin
    select count(1) into num from user_tables where table_name = upper( 't' );
    if num = 1 then 
        execute immediate 'drop table eoda.t';
    end if;
    execute immediate '
        create table eoda.t
        as 
        select * from all_objects
         where rownum <= 50000
    ';
end;
/

prompt
prompt 创建索引eoda.t_idx
declare 
    num number;
begin
    select count(1) into num from user_indexes where table_name = upper( 't' ) and index_name = upper( 't_idx' );
    if num = 1 then 
        execute immediate 'drop index eoda.t_idx';
    end if;
    execute immediate '
        create index eoda.t_idx on eoda.t( owner,object_type,object_name )
    ';
end;
/

prompt 
prompt 分析eoda.t_idx
begin
    execute immediate 'analyze index eoda.t_idx validate structure';
end;
/

prompt
prompt 创建表eoda.idx_stats
declare 
    num number;
begin
    select count(1) into num from user_tables where table_name = upper( 'idx_stats' );
    if num = 1 then 
        execute immediate 'drop table eoda.idx_stats';
    end if;
    execute immediate '
        create table eoda.idx_stats 
        as
        select ''noncompressed'' what, a.* 
          from index_stats a
    ';
end;
/
