0
 create or replace procedure BAS_NUM_UPD  is

 cursor cur is

 select distinct o.oi_b,mpr.pa_ke_i,ltrim(substr(convert_171_to_711(cp.p_t_num),1,7),'0') bs_nbr

    from t_obj o, mat_pa_rel mp, cor_pa cp
    where o.ob_t = 'something'
    and o.oi_b = mp.oi_b
    and mp.pa_ke_i = cp.pa_ke_i;

 l_ba_num_at_i  number(10) := get_attribute_id('Ba  timber');

 flag1 VARCHAR2(10);

 type t1 is table of varchar2(10);
 par_k t1;

 BEGIN
     for x in cur loop
 BEGIN      

   select pa_ke_i into par_k from mat_pa_rel where oi_b=x.oi_b ;

  if par_k.count=null  then  

  insert into cs_val (oi_b, at_i, value, flag, ) values (x.oi_b, l_ba_num_at_i, null, 1);

  end if;

  select flag into flag1 from cs_val where at_i = l_ba_num_at_i  and oi_b = x.oi_b
    and value = x.bs_nbr;

  EXCEPTION 

    when NO_DATA_FOUND THEN

      insert into cs_val (oi_b, at_i, value, flag, )
          values (x.oi_b, l_ba_num_at_i, x.bs_nbr, 1);

    flag1 :='Nothing';

    when OTHERS 
then
       raise_application_error(-20011,'Unknown Exception in PROCEDURE');
END;

end loop;
end BAS_NUM_UPD;

错误:PLS-00642:SQL 语句中不允许本地集合类型

4

2 回答 2

1

如果您进行批量收集,您应该让它运行

select pa_ke_i bulk collect into par_k from mat_pa_rel where oi_b=x.oi_b ;

然后我认为if是不正确的。我认为你需要做

if par_k.count = 0 then

但老实说,你可能只是数一数

select count(*) into l_cnt from mat_pa_rel where oi_b=x.oi_b;

If l_cnt = 0 then ...

当然 l_cnt 必须被定义。

于 2012-07-30T20:13:29.700 回答
0

您应该type t1在模式中创建而不是在 pl/sql 块中创建。

于 2012-07-30T14:59:55.950 回答