[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Matching "&" in oracle

Posted on 2004-10-27
7
Medium Priority
?
1,935 Views
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.

0
Comment
Question by:sathyagiri
5 Comments
 
LVL 25

Expert Comment

by:lwadwell
ID: 12427764
try

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

Accepted Solution

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

Expert Comment

by:paquicuba
ID: 12427857
Just an example:

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

&
-
&

SQL>
0
 
LVL 12

Assisted Solution

by:catchmeifuwant
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
0
 
LVL 14

Author Comment

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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses
Course of the Month7 days, 17 hours left to enroll

607 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