欢迎投稿

今日深度:

遍历关联数组index by varchar2

遍历关联数组index by varchar2


遍历关联数组index by varchar2
 
--字符串序列要这样
declare
    type t   is table of number(3) index by varchar2(3);
   hash_t t;  
   l_row varchar2(3);
  begin
  hash_t('a') := 10;
  hash_t('b') := 20;  
  l_row :=hash_t.first;
  while(l_row is not null) loop
  dbms_output.put_line(hash_t(l_row));
  l_row:=hash_t.next(l_row);
  end loop;
  end;
--数字序列可以这样
declare
    type t   is table of number(3) index by pls_integer;
   hash_t t;  
   l_row varchar2(3);
  begin
  hash_t(1) := 10;
  hash_t(2) := 20;  
  for i in hash_t.first .. hash_t.last loop
  dbms_output.put_line(hash_t(i));
  end loop;
  end;

 

 

www.htsjk.Com true http://www.htsjk.com/oracle/20968.html NewsArticle 遍历关联数组index by varchar2 遍历关联数组index by varchar2 --字符串序列要这样declare type t is table of number(3) index by varchar2(3); hash_t t; l_row varchar2(3); begin hash_t(a) := 10; hash_t(b) := 20; l_row :=hash_t...
相关文章
    暂无相关文章
评论暂时关闭