[size=12px]有一下sql语句:
select t2.logdate as logdate,
t2.procname as procname,
t2.begin_date as begin_date,
from t_log t2
where t2.procname like '% p_interface_income('CDR_IGO') %'
order by t2.logdate desc现在的问题是:在like模糊查询时,如果字段的内容为“p_interface_income('CDR_IGO')”这种形式时,
因为“p_interface_income('CDR_IGO')”是数据表中的内容,
无法实现查询,会报错。有什么解决办法呢?
[/size]

解决方案 »

  1.   

    select t2.logdate as logdate,
    t2.procname as procname,
    t2.begin_date as begin_date
    from t_log t2
    where t2.procname like '% p_interface_income(''CDR_IGO'') %'
    order by t2.logdate desc
      

  2.   

    SQL> select t.*, t.rowid from a_count t WHERE T.B  LIKE '%p_interface_income(''CDR_IGO'')%';         A B                                                                                ROWID
    ---------- -------------------------------------------------------------------------------- ------------------
             1 p_interface_income('CDR_IGO')                                                    AAANgoAAEAAAAGkAAASQL> 
      

  3.   

    “p_interface_income('CDR_IGO')”是从其他表select出来的数据,根据这个数据like模糊查询;
      

  4.   

    主要还是字符里面有引号的吗?
    SELECT 'p_interface_income(''CDR_IGO'')' FROM dual;
      

  5.   

    用replace再套一层好了,把单引号改为双引号。