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

prompt 
prompt 创建存储过程eoda.p1
create or replace procedure eoda.p1
as
begin
    for x in ( select * from all_objects )
    loop 
        insert into eoda.t values x;
        commit;
    end loop;
end;
/

prompt
prompt 创建存储过程eoda.p2
create or replace procedure eoda.p2
as 
begin
    for x in ( select * from all_objects ) 
    loop
        insert into t values x;
        commit write nowait;
    end loop;
end;
/

prompt 
prompt 执行eoda.p1
begin
    execute immediate 'truncate table eoda.t';
    eoda.p1;
end;
/

prompt 
prompt 执行eoda.p2
begin
    execute immediate 'truncate table eoda.t';
    eoda.p2;
end;
/
