Home » SQL & PL/SQL » SQL & PL/SQL » special characters in between the string
special characters in between the string [message #256983] Tue, 07 August 2007 05:35 Go to next message
sathyam2627
Messages: 52
Registered: November 2006
Member
Hi to all,
I am sathya,I am having a small query. suppose i would like to update my department name from MD to M&D.
How to include that special charcter in between the name.

if i try with this query

update dept_mst set dept_name = 'M'&'D'
where dept_name like='MD';


it is getting updated like this M'&'D

kindly help me out..

Regards,
sathya..

Re: special characters in between the string [message #256991 is a reply to message #256983] Tue, 07 August 2007 05:52 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Are you sure that the following is executing successfully?
Quote:
update dept_mst set dept_name = 'M'&'D'
where dept_name like='MD';

By
Vamsi
Re: special characters in between the string [message #256992 is a reply to message #256991] Tue, 07 August 2007 05:56 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Are you looking for this?
faq
By
Vamsi
Re: special characters in between the string [message #257160 is a reply to message #256983] Tue, 07 August 2007 12:18 Go to previous messageGo to next message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
use an escape

update dept_mst set dept_name = 'M\&D'
where dept_name like='MD';

[Updated on: Tue, 07 August 2007 12:18]

Report message to a moderator

Re: special characters in between the string [message #257166 is a reply to message #257160] Tue, 07 August 2007 12:32 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Don't forget to set the escape character:
SQL> select  'M\&D' from dual;
Enter value for d: 
'M
--
M\

1 row selected.

SQL> set escape '\'
SQL> select  'M\&D' from dual;
'M&
---
M&D

1 row selected.

Regards
Michel
Re: special characters in between the string [message #257167 is a reply to message #256983] Tue, 07 August 2007 12:33 Go to previous message
Bill B
Messages: 1971
Registered: December 2004
Senior Member
Embarassed

Your right, I should never assume that the user would know how to set the escape.
Previous Topic: Select In Trigger
Next Topic: Oracle Time Difference
Goto Forum:
  


Current Time: Tue Feb 18 01:27:24 CST 2025