'&' character in update query [message #374867] |
Mon, 09 July 2001 04:03 |
Konstantin
Messages: 6 Registered: June 2001
|
Junior Member |
|
|
I run the following query:
update const_db set pc_nameofplace_1='straub clinic & hospital' where pc_nameofplace_1 like 'straub cl%';
But instead of setting this field to 'straub clinic & hospital' it sets 'straub clinic hospital'. How can I fix it?
Thanks in advance.
|
|
|
|
Re: '&' character in update query [message #374875 is a reply to message #374867] |
Mon, 09 July 2001 10:10 |
cl
Messages: 10 Registered: April 2001
|
Junior Member |
|
|
SQL> SET ESCAPE ON
SQL> update const_db
SQL> set pc_nameofplace_1='straub clinic \& hospital'
SQL> where pc_nameofplace_1 like 'straub cl%';
OR
if ESCAPE is set off(by default most systems SET ESCAPE OFF....to see all default setting type:
SQL> show all ), then do this:
SQL> update const_db
SQL> set pc_nameofplace_1='straub clinic \& hospital' ESCAPE '\'
SQL> where pc_nameofplace_1 like 'straub cl%';
Either method should work.
|
|
|
Re: '&' character in update query [message #374902 is a reply to message #374867] |
Tue, 10 July 2001 12:51 |
Kurt Berry
Messages: 3 Registered: July 2001
|
Junior Member |
|
|
I have always found it easier to use the CHR() function to translate the character I needed to add when that particular character was a key part of the syntax, especially when I go back and look at the code later and try to figure out what I coded and why. For example:
update const_db set pc_nameofplace_1='straub clinic ' || CHR(38) || ' hospital' where
pc_nameofplace_1 like 'straub cl%';
Maybe not the perfect solution, but it works.
|
|
|