天天看點

索引表的使用

create or replace package testref as

  type t_temp is table of varchar2(30) index by binary_integer;

  type t_num is table of varchar2(2);

  --v_temp is ref t_temp;

  function test return t_temp;

  procedure callt_temp;

end testref;

create or replace package body testref as

  function test return t_temp as

  v_temp1 t_temp;

  begin

    v_temp1(1) := 'shu';

    v_temp1(2) := 'jian';

    v_temp1(3) := 'bo';

    return v_temp1;

  end test;

  procedure callt_temp as

    v_aa t_temp;

    v_num t_num := t_num('1','2','3','4','5','6','7','8','9');

    v_aa := test();

    for i in 1..v_aa.count

    loop

      dbms_output.put_line(v_aa(i));   

    end loop;

    for i in 1..v_num.count

      dbms_output.put_line(v_num(i));

  end callt_temp;

繼續閱讀