drop table t;
set echo on

clear screen
create table t
as
select * 
  from stage
/
exec dbms_stats.gather_table_stats( user, 'T' );
select blocks, blocks/10 from user_tables where table_name = 'T';
pause

clear screen
begin
    dbms_parallel_execute.create_task('update t');
    dbms_parallel_execute.create_chunks_by_rowid
    ( task_name   => 'update t', 
      table_owner => user, 
      table_name  => 'T', 
      by_row      => false, 
      chunk_size  => 100);
end;
/
pause

clear screen
select chunk_id, status, start_rowid, end_rowid
  from dba_parallel_execute_chunks
 where task_name = 'update t'
   and rownum <= 5
/
pause

clear screen
begin
    dbms_parallel_execute.run_task
    ( task_name      => 'update t', 
      sql_stmt       => 'update t 
                            set object_name = lower(object_name) 
                          where rowid between :start_id 
                                          and :end_id',
      language_flag  => DBMS_SQL.NATIVE,
      parallel_level => 2 );
end;
/
pause

clear screen
select chunk_id, status, start_rowid, end_rowid
  from dba_parallel_execute_chunks
 where task_name = 'update t'
   and rownum <= 5
/
pause


clear screen
begin
      dbms_parallel_execute.drop_task('update t');
end;
/
pause

clear screen
select chunk_id, status, start_rowid, end_rowid
  from dba_parallel_execute_chunks
 where task_name = 'update t'
/
pause
