Home » RDBMS Server » Server Administration » search for & in a string
search for & in a string [message #371402] Fri, 13 October 2000 07:37 Go to next message
Steven
Messages: 13
Registered: May 1999
Junior Member
Can anyone tell me how to search for an & in a string
I assume there is an escape key but '%\&%' does not work

Thanks in advance

Steven
Re: search for & in a string [message #371407 is a reply to message #371402] Fri, 13 October 2000 11:38 Go to previous messageGo to next message
Prem
Messages: 79
Registered: August 1998
Member
steven,

You can use something like
SELECT * FROM EMP
WHERE INSTR(ENAME , '&') > 0;

This is similar to the above requirement. If u r executing the sql from sql*plus, you can set the

SET DEFINE '~'
this will not treat & as an input character. Now if you say
SELECT * FROM EMP WHERE ENAME LIKE '%&%'

it will work

hth

Prem :)
Re: search for & in a string [message #371417 is a reply to message #371402] Mon, 16 October 2000 19:09 Go to previous message
Andrew again...
Messages: 270
Registered: July 2000
Senior Member
Try

... where mycol like '%\&%' ESCAPE '\';

In SQLplus you can also enter the command "set scan off" to avoid Oracle scanning for substitution variables.
Previous Topic: How to get the ipadress of the terminals connected to oracle
Next Topic: extracting table name from variable
Goto Forum:
  


Current Time: Sun Dec 22 15:42:52 CST 2024