日期:2014-05-17 浏览次数:20883 次
方法1 select * from users where dept_code in ('0000005','0000026') create or replace procedure mypro(pkey in varchar2) as begin dbms_output.put_line(pkey); for c in( select * from mgs_users where dept_code in (pkey)) loop update mgs_users set enabled='N' where USER_ID = c.USER_ID; end loop; end; begin mypro('''0000005'''||chr(44)||'''0000026'''); end; ================================================================================================== 方法2 select * from mgs_users where dept_code in ('0000005','0000026') create or replace procedure mypro(pkey in varchar2) as v_str varchar2(500); begin dbms_output.put_line(pkey); v_str:='begin for c in( select * from mgs_users where dept_code in ('||pkey||')) loop '; v_str:=v_str||'update mgs_users set enabled=''Y'' where USER_ID = c.USER_ID; ' ; v_str:=v_str||'end loop;end;' ; execute immediate v_str; commit; end; begin mypro('''0000005'',''0000026'''); end;