create or replace procedure sp_check_to_et(
  wf_id_in           in        number,
  form_data_id_in    in        number,
  et_id          in        varchar2
 -- return_code        out       number,
  --return_desc        out       varchar2
 )
as
  type c_array  is table of varchar2(10) index by binary_integer;
  p number default 0;
  idx number default 0;
  strc varchar2(500);
  ca c_array;
  et_id2 varchar(500);
begin    strc:=et_id;
    loop
        p:=instr(strc,'-',1);
        exit when p=0;
        ca(idx):=substr(strc,1,p-1)||',';
        dbms_output.put_line(ca(idx));
        idx:=idx+1;        p:=instr(strc,'|',1);
        exit when p=0;
        strc:=substr(strc,p+1,length(strc));
    end loop;
     declare
  cursor indexs
    is
     select status_id   from ecl_request_sheet where request_id in(ca(idx)) and container_type=4 ;
   
     --定义一个游标变量
        c_row indexs%rowtype;begin
         open indexs;
         loop
         fetch indexs into c_row;
         exit when indexs%notfound;
          
        if c_row.status_id<>6 then
        -- return_code:=1;
       --  return_desc:='销售合同未结束';
       dbms_output.put_line('OK');
        else
      --   return_code:=0;
       dbms_output.put_line('NO');
        end if;
       end loop;       --关闭游标
       close indexs;
    end; COMMIT;  EXCEPTION  WHEN OTHERS THEN
  ROLLBACK;
  RAISE;END;请问我这样里有什么问题。。上面是截取数据
类似101532-国外出差审批流程 [ 0|P,106-管理员 ] |101530-国外出差审批流程 [ 0|P,106-管理员 ]
这样两条 我只取它们的ID:101530,101532
中间写的显示游标。获得多列查询我截取出来的保存变量不能作为条件查询么?
错误是未找到任何数据。
 select status_id   from ecl_request_sheet where request_id in(ca(idx)) and container_type=4 ; 我把in后面的  换成(101530,101532)写死又可以。。逻辑是这样:我要截取ID作为条件查询。。存储

解决方案 »

  1.   

    你的Id 需要定义一个类型
    比如:c_request_id  ecl_request_sheet.request_id%type;
     cursor indexs
        is
        select status_id   from ecl_request_sheet where request_id in(c_request_id) and container_type=4 ;
       
         --定义一个游标变量
            c_row indexs%rowtype;
    begin
            c_request_id:=ca(idx);
             open indexs;
             loop
             fetch indexs into c_row;
             exit when indexs%notfound;这样才行,要不然,变量是不识别的
      

  2.   

    请问下具体在哪里定义呢 
    还有我昨天截取还行,,今天怎么截取就截取不到ID了 
    这种类型的了101532,P,106,101530,P,106,