Matching "&" in oracle

I have a column "A" in a table "T" which has a data with special characters like &.
For example lets say the values is P&L
Now if I write a query
select * from T where A = 'P&L';
It prompts me for the value of L, instead of matching the record. I know that this is because of & being a special character. I tried negating the special character using \ and {} , it doesnt work.
Also I do not want to use like '%&%'...in my where clause.

LVL 14
sathyagiriAsked:
Who is Participating?
 
paquicubaCommented:
set define off works fine
0
 
lwadwellCommented:
try

where A = 'P' || '&' || 'L'
0
 
paquicubaCommented:
Just an example:

SQL> set define off
SQL> select '&' "&" from dual;

&
-
&

SQL>
0
 
catchmeifuwantCommented:
In sql issue the command:

sql> set escape off
sql> select * from T where A = 'P\&L';

Answer to a similar question : http://www.experts-exchange.com/Databases/Oracle/Q_21184273.html
0
 
sathyagiriAuthor Commented:
Thanks a lot both set define off and set escape off works fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.