Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Matching "&" in oracle

Posted on 2004-10-27
Medium Priority
Last Modified: 2010-10-05
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.

Question by:sathyagiri
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 25

Expert Comment

ID: 12427764

where A = 'P' || '&' || 'L'
LVL 23

Accepted Solution

paquicuba earned 252 total points
ID: 12427840
set define off works fine
LVL 23

Expert Comment

ID: 12427857
Just an example:

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


LVL 12

Assisted Solution

catchmeifuwant earned 248 total points
ID: 12430275
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
LVL 14

Author Comment

ID: 12433687
Thanks a lot both set define off and set escape off works fine.

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question