日期:2014-05-16  浏览次数:20425 次

数组集合类型 index table
-- Created on 2010/05/18 by NAN
declare
  -- Local variables here
  i integer;
  TYPE t_table IS TABLE OF VARCHAR2(20 ) INDEX BY VARCHAR2 (20);
  v_table t_table;
  v_str VARCHAR2( 20);
BEGIN
  v_table('a') := 'aa';
  v_table('b') := 'bb';

  v_str := v_table.first;
  WHILE v_str IS NOT NULL LOOP
      dbms_output.put_line(v_table(v_str));
      v_str := v_table.next(v_str);
  END LOOP;
   
  EXCEPTION
      WHEN OTHERS THEN
           dbms_output.put_line( sqlerrm);
end;