declare
v_count number := 1000000;
v_rnd number := 0;
ii varchar2(128);
v_dummy_vc2 varchar2(32767);
v_dummy_nr number;
v_dummy_dt date;
c_VC2_TYPE constant varchar2(1) := 'V';
c_NR_TYPE constant varchar2(1) := 'N';
c_DT_TYPE constant varchar2(1) := 'D';
type my_type is table of tom_any_data index by varchar2(128);
t_my_type my_type;
begin
help.out('=== MY TYPE VARCHAR2 ===');
-- help.mem;
help.b;
for i in 1 .. v_count loop
v_rnd := mod(i, 3);
t_my_type(i) := new tom_any_data;
case v_rnd
when 0 then t_my_type(i).setVc2('test ' || i);
when 1 then t_my_type(i).setNr(to_number((i + v_rnd)));
when 2 then t_my_type(i).setDt(to_date((sysdate - (i/10))));
else help.out('???');
end case;
end loop I;
help.i('fill my type');
ii := t_my_type.first;
while ii is not null loop
case t_my_type(ii).getType
when c_VC2_TYPE then v_dummy_vc2 := t_my_type(ii).getVc2;
when c_NR_TYPE then v_dummy_nr := t_my_type(ii).getNr;
when c_DT_TYPE then v_dummy_dt := t_my_type(ii).getDt;
end case;
ii := t_my_type.next(ii);
end loop II;
help.i('loop my type');
help.e;
help.show;
-- help.mem;
end;
=== MY TYPE VARCHAR2 ===
step start d_step cpu d_cpu text
---- ------- ------- ------- ------- ----------------------------------------------------------
0. 0.0000 0.0000 0.0000 0.0000 BEGIN
1. 9.9700 9.9700 6.0500 6.0500 fill my type
2. 11.5500 1.5800 7.6300 1.5800 loop my type
3. 11.5500 0.0000 7.6300 0.0000 END