斜杠\,不就是select '\','&' from table 还有,楼主你的说的处理指的是什么?sql分析吗?
看来是我没说清楚,我的意思说遇到\,'这种特殊字符应该怎么办?比如这句select * from table where name = 'sdfsdf\&'',这样直接写肯定不行的,像在MYSQL里面就是直接在特殊字符前面加\就可以了,就变成select * from table where name = 'sdfsdf\\\&\''。这样就Ok了,可是在ORAcle里面,这样不行啊,怎么样才能实现正常的查询呢
select * from table where name = '%' select * from table where name ='&' select * from table where name ='\' 都是可以的,但 select * from table where name = 'asdf&%'就不可以
我们可以试试: create table table1(col1 varchar2(10)); insert into table1 values('\'); insert into table1 values('&'); insert into table1 values('%'); insert into table1 values('sdfsdf\&'''); commit;select * from table1;COL1 ---------- \ & % sdfsdf\&'SELECT * FROM table1 WHERE col1 LIKE '%\%';COL1 ---------- \ sdfsdf\&'
还有,楼主你的说的处理指的是什么?sql分析吗?
select * from table where name ='&'
select * from table where name ='\'
都是可以的,但
select * from table where name = 'asdf&%'就不可以
create table table1(col1 varchar2(10));
insert into table1 values('\');
insert into table1 values('&');
insert into table1 values('%');
insert into table1 values('sdfsdf\&''');
commit;select * from table1;COL1
----------
\
&
%
sdfsdf\&'SELECT * FROM table1 WHERE col1 LIKE '%\%';COL1
----------
\
sdfsdf\&'
可以考虑用like
相关资料说可以用q来转义,但对&无效。