本帖最后由 lshshendun2688 于 2011-07-25 09:48:12 编辑

解决方案 »

  1.   

    select * from table where instr(id,str)>0
      

  2.   


    select * from table where id in (
      select regexp_substr(str,'[^,]+',1,level)
        from dual
        connect by level <= length(str)-length(replace(str,','))+1);
      

  3.   

    -- 给个例子给你: 
      
     eygle@SZTYORA> select empno, ename from emp; 
      
          EMPNO ENAME 
     ---------- -------------------- 
           7499 ALLEN 
           7521 WARD 
           7654 MARTIN 
           7844 TURNER 
           7900 JAMES 
           7369 SMITH 
           7876 ADAMS 
      
     已选择7行。 
      
     eygle@SZTYORA> create or replace procedure emp_proc(v_empnos varchar2, o_cur out sys_refcursor) 
       2  is 
       3  begin 
       4    open o_cur for 'select t.ename from emp t where t.empno in ('||v_empnos||')'; 
       5  end; 
       6  / 
      
     过程已创建。 
      
     eygle@SZTYORA> 
     eygle@SZTYORA> set serveroutput on; 
     eygle@SZTYORA> var c_cur refcursor; 
     eygle@SZTYORA> exec emp_proc('7369,7876',:c_cur); 
      
     PL/SQL 过程已成功完成。 
      
     eygle@SZTYORA> print c_cur; 
      
     ENAME 
     -------------------- 
     SMITH 
     ADAMS
      

  4.   

    http://topic.csdn.net/u/20110331/10/35ae9f81-e437-48ac-8de3-4bc4af1b66e0.html
      

  5.   

    string sql="SELECT * FROM TABLE WHERE id InStr(str)"
      

  6.   

    select * from table where id in str.replace(",","','")  将str字符串的中“,”替换成“‘,’”即:str='1','2','3','4'