Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

Index by binary integer or by varchar2

SQL> declare   2   type charListType is table of number index by varchar2(100);   3   vc charListType;   4   type numberListType is table of number index by binary_integer;   5   n numberListType;   6   t number;   7   begin   8       t := dbms_utility.get_time;   9       for i in 1 .. 1000 loop  10           n(i*1000) := i;  11       end loop;  12       dbms_output.put_line('Index by Number : '||(dbms_utility.get_time-t));  13       t := dbms_utility.get_time;  14       for i in 1 .. 1000 loop  15           vc(i*1000) := i;  16       end loop;  17       dbms_output.put_line('Index by Varchar2: '||(dbms_utility.get_time-t));  18   end;  19  / Index by Number : 0 Index by Varchar2: 1 PL/SQL procedure successfully completed. SQL> SQL>