请教高手这个存储过程怎么调用?
 create OR REPLACE procedure proc_Pope_OneLevel (In_RoleId number,In_Ids varchar2)
 is
 begin
    update ActiveRole set allow=0 where RoleId=In_RoleId and Menu_AId<2000;
    update ActiveRole set allow=1 where RoleId=In_RoleId and Menu_AId in (In_Ids);
 end;
/exec proc_Pope_OneLevel (9,'1000,1001,1002');这样调用会报错。
ORA-01722: 无效数字
ORA-06512: 在 "CELE.PROC_POPE_ONELEVEL", line 5
ORA-06512: 在 line 2能我帮我解释下么,小弟初学Oracle,不太会。

解决方案 »

  1.   


    update ActiveRole set allow=1 where RoleId=In_RoleId and Menu_AId in (In_Ids);
    --这种写法错的In_Ids是一个字符串,而不是几个数字的集合
      

  2.   


    --试下,有问题再提出
    create OR REPLACE procedure proc_Pope_OneLevel (In_RoleId number,In_Ids varchar2)
     is
    strsql varchar2(2000);
     begin
      update ActiveRole set allow=0 where RoleId=In_RoleId and Menu_AId<2000;
      strsql := 'begin update ActiveRole set allow=1 where RoleId=In_RoleId and Menu_AId in ('||In_Ids||'); end;';
      execute immediate strsql;
     end;
    /
      

  3.   

    update ActiveRole set allow=1 where RoleId=In_RoleId 
    and instr(In_Ids,Menu_AId,1)>0;
      

  4.   

    update ActiveRole set allow=1 where RoleId=In_RoleId 
    and instr(In_Ids,Menu_AId,1)>0;