一个存储过程,输入变量是c_in
select * from test 
where aa like '%'+ c_in +'%' 
这样不行.
我的where里要怎么写?谢谢大家了.

解决方案 »

  1.   

    '%' || c_in || '%'
      

  2.   

    execute immediate 'select * from test where aa like ''%'|| c_in ||'%''' ;
      

  3.   

    其实是这样,传过来的这个参数是查询条件.
    '%' || c_in || '%'写好象也不行,把所有的都查出来了.我的过程如下:procedure pk_mpb_jfpc_edit_GetQueryRec(ret_cursor out mycursor , condition_in in varchar2) as begin open ret_cursor for select a.*, b.*  from mpb_jfpc a, userinfo b  where (a.userID = b.userID ) and ( (a.danwei like  '%'||condition_in||'%' ) or 
     (b.logname like  '%'||condition_in||'%' ));
    end pk_mpb_jfpc_edit_GetQueryRec;end pk_mpb_jfpc_edit; 
      

  4.   

    哈,搞定,谢谢  waterfirer(水清) 和  sasacat(傻傻猫) 
    '%' || c_in || '%'
    正解