解决方案 »

  1.   

    declare
      v_strtypeno varchar2(4000);
     type curtype   is     REF    cursor;
      A  curtype;
    BEGIN
      v_strtypeno:='你的参数';
      open A FOR 'select distinct (t.accpaytype), t.comcode, t.depcode
      from ap_settleplan t
      where t.apcode in ('''||v_strtypeno||''')';
    --你的游标中的操作
      close A;
    END;
      

  2.   

    你的参数格式选择这种'B31307100002','B31307100002'
    declare
      v_strtypeno varchar2(4000);
     type curtype   is     REF    cursor;
      A  curtype;
    BEGIN
      v_strtypeno:='你的参数';
      open A FOR 'select distinct (t.accpaytype), t.comcode, t.depcode
      from ap_settleplan t
      where t.apcode in ('||v_strtypeno||')';
    --你的游标中的操作
      close A;
    END;
      

  3.   

    v_strtypeno采用这种B31307100002,B31307100002
    条件修改下,这么用法和你现在用法就一致了
    select distinct (t.accpaytype), t.comcode, t.depcode
            from ap_settleplan t
           where instr (','||v_strtypeno||',',','||t.apcode||',')>0;
      

  4.   

    本帖最后由 wildwave 于 2014-08-07 11:05:36 编辑
      

  5.   

    算了。这个demo可以测试下
    table()将集合构造出来的内存表在数据字典里没有统计信息,因此也不太容易用上索引
    除非在select语句中加上index的hint
    在你的这个环境中可能比较适用,但具体情况要看测试结果,考虑所有情况,权衡以后使用