type CLMTABLE is table of varchar2(100) index by varchar2(1000);
  t_SCLM CLMTABLE;
  t_KCLM CLMTABLE;
 begin
  t_SCLM.delete;
  t_KCLM.delete;
  for rec_clm in (select * from cfg_lov_map) loop
    t_SCLM(rec_clm.src_id || rec_clm.src_type || rec_clm.src_code) := rec_clm.sib_code;
    t_KCLM(rec_clm.src_id || rec_clm.src_type || rec_clm.src_code) := rec_clm.ken_code;
  end loop;
  function fun_val_clm(p_SrcID   varchar2,
                       p_SrcType varchar2,
                       p_SrcCode varchar2,
                       p_Domain  varchar2) return varchar2 is  begin
    case p_Domain
      when 'SK' then
        if t_SCLM(p_SrcID || p_SrcType || p_SrcCode) is null or
           t_KCLM(p_SrcID || p_SrcType || p_SrcCode) is null then
          return 'FAILED';
        else
          return t_KCLM(p_SrcID || p_SrcType || p_SrcCode);
        end if;      when 'S' then
        if t_SCLM(p_SrcID || p_SrcType || p_SrcCode) is null then
          return 'FAILED';
        else
          return t_SCLM(p_SrcID || p_SrcType || p_SrcCode);
        end if;      when 'K' then
        if t_KCLM(p_SrcID || p_SrcType || p_SrcCode) is null then
          return 'FAILED';
        else
          return t_KCLM(p_SrcID || p_SrcType || p_SrcCode);
        end if;
    end case;
  exception
    when no_data_found then
      return 'FAILED';
    when others then
      raise;
  end fun_val_clm;
我的问题是:    t_SCLM(rec_clm.src_id || rec_clm.src_type || rec_clm.src_code) := rec_clm.sib_code;这句话是什么意思?

解决方案 »

  1.   

    应该是相当于t_sclm表中rec_clm.src_id ¦ ¦ rec_clm.src_type ¦ ¦ rec_clm.src_code
    三个字段连接起来
      

  2.   

    我后来查了下资料,看到说ORACLE 的索引表也叫关联数组(Index-by Table),
    在Oracle9iRelease 2以后index 可以使用Varchar2.以前是使用BINARY_INTEGER的.
    type ename_table_type is table of emp.ename%type  index by binary_integer所谓的可变数组是指: Varray,也较变长数组, 语法是这样的: 
    Create type varray_emp as VARRAY(100) OF emp%rowtype
    可以把这种表理解为一个MAP,在这种数据结构中,是以键-值对存储的。
    在上面的例子中,它的值就是varchar2(100)这个长度,键就是varchar2(1000)长度,
    即在 t_SCLM(rec_clm.src_id ¦ ¦ rec_clm.src_type ¦ ¦ rec_clm.src_code) := rec_clm.sib_code;这句话里面,
    rec_clm.src_id ¦ ¦ rec_clm.src_type ¦ ¦ rec_clm.src_code连接起来作为键,长度小于1000,
    rec_clm.sib_code是值,长度小于100.不知道我的理解是否正确,请各位大侠不吝指教!!!!!1