set define off;
在命令行执行这个,关闭替换变量的功能,就可以执行啦。
SQL> set define off;
SQL> 
SQL> select name
  2  from(
  3  select '223&abc' name from dual
  4  union all
  5  select '223bc' name from dual
  6  ) p
  7  where name like '%/&abc%'
  8  ;
 
NAME
-------
 
SQL> 
SQL> select name
  2  from(
  3  select '223&abc' name from dual
  4  union all
  5  select '223bc' name from dual
  6  ) p
  7  where name like '%&abc%'
  8  ;
 
NAME
-------
223&abc

解决方案 »

  1.   

    需要使用转义字符select * from table1 where column1  =''||'&'||'abc';
      

  2.   

    & 不能通过escape转义,用如下转义SQL> select ascii('&') from dual;ASCII('&')
    ----------
            38
    select * from table1 where columan1 like '||chr(38)||abc' 
      

  3.   

    有点不太明白啥意思?
    &这个是个特殊字符。
    select &a    from dual;  这个就是要输入a的一个值,然后才会返回结果;
    如果想要插入这个特殊符号,网上有方法的。
    http://blog.chinaunix.net/uid-20601384-id-1618294.html
      

  4.   

    特殊字符无误,不过只要&后面不加字符sql引擎就认为它也是用作普通字符,例如:WHERE columan1  LIKE '%&' || 'abc%'这样是OK的,但是如果&abc那相当于abc作为变量,输入某个值,把这个值当成你的条件。
      

  5.   

    其实很简单,就是个转义符的问题,oracle 中是这样的:
    WHERE ColumnA LIKE '%5/&%'  ESCAPE '/' 表示 模糊查询含‘5&’ 的字符串
      

  6.   

    不能通过ESCAPE处理&,得用chr(38)处理。