自定义类型: create or replace type arry_number as table of number(15);以下是函数片段:l_data arry_number := arry_number();update t_config
set configvalue =1
where configtype = 2
returnning configid
bulk collect
into l_data --这里已经取到值了。。open p_cursor for
select t.configid form t_config t where t.configid in (
select column_value
from TABLE ( cast ( l_data as arry_number) )   
这一段代码不能获取到值,不知道是cast有问题,还是select语句有问题
);
说明:
语法没有问题。编译也通过了。现在的问题是最后那一段获取不到值,不知道是cast转换有问题,还是哪里有问题,有没有牛人帮忙解决以下问题。。很急,在线等。
  

解决方案 »

  1.   

    SQL> declare
      2  l_data arry_number := arry_number();
      3  type p_cursor_type is ref cursor;
      4  p_cursor p_cursor_type;
      5  v_configid t_config.configid%type;
      6  begin
      7  update t_config set configvalue =1 where configtype = 2
      8  returning configid bulk collect into l_data;
      9  open p_cursor for select t.configid from t_config t where t.configid in (
     10  select column_value from TABLE(l_data));
     11  fetch p_cursor into v_configid;
     12  while p_cursor%found loop
     13  dbms_output.put_line(v_configid);
     14  fetch p_cursor into v_configid;
     15  end loop;
     16  close p_cursor;
     17  end;
     18  /
    11
    12
    13
    14
    15
    15PL/SQL 过程已成功完成。SQL> commit;提交完成。SQL> select * from t_config
      2  /  CONFIGID CONFIGVALUE CONFIGTYPE
    ---------- ----------- ----------
             1           1          1
             2           2          1
             3           3          1
             4           4          1
             5           5          1
             6           6          1
             7           7          1
             8           8          1
             9           9          1
            10          10          1
            11           1          2  CONFIGID CONFIGVALUE CONFIGTYPE
    ---------- ----------- ----------
            12           1          2
            13           1          2
            14           1          2
            15           1          2
            15          15          3
            16          16          3
            17          17          3
            18          18          3已选择19行。
    --自己看吧